Hi all,
I have a global variable, FinalRow, which calculates the finalrow of the records in the Worksheet_Activate event.
The global variable is declared in a module.
I created a button and assigned a macro (below) to it to allow users to view the records. I used an array in it.
Sub View_All_Records_Form()
Dim ArrayOfAllRecords As Variant
ArrayOfAllRecords = Worksheets("MasterList").Range("A3:AG" & FinalRow)
Load frm_ViewAllRecords
With frm_ViewAllRecords
.txt_VARDealType = ArrayOfAllRecords(1, 1)
End With
frm_ViewAllRecords.Show
End Sub
I used FinalRow, the global variable, for the filling of data in the array. frm_ViewAllRecords is the userform.
Now when i press the button, the userform loads. But after i close it by pressing the red X button at the top right hand corner of the window, and press the button once more, an error is generated.
Run time error 1004
"Application-defined or object-defined error"
I press debug and the following row is highlighted.
ArrayOfAllRecords = Worksheets("MasterList").Range("A3:AG" & FinalRow)
When i hover my mouse over to 'FinalRow', the value is 0.
Please advice me.
I'm using excel 2003
Thank you
Shie Boon
I have a global variable, FinalRow, which calculates the finalrow of the records in the Worksheet_Activate event.
The global variable is declared in a module.
I created a button and assigned a macro (below) to it to allow users to view the records. I used an array in it.
Sub View_All_Records_Form()
Dim ArrayOfAllRecords As Variant
ArrayOfAllRecords = Worksheets("MasterList").Range("A3:AG" & FinalRow)
Load frm_ViewAllRecords
With frm_ViewAllRecords
.txt_VARDealType = ArrayOfAllRecords(1, 1)
End With
frm_ViewAllRecords.Show
End Sub
I used FinalRow, the global variable, for the filling of data in the array. frm_ViewAllRecords is the userform.
Now when i press the button, the userform loads. But after i close it by pressing the red X button at the top right hand corner of the window, and press the button once more, an error is generated.
Run time error 1004
"Application-defined or object-defined error"
I press debug and the following row is highlighted.
ArrayOfAllRecords = Worksheets("MasterList").Range("A3:AG" & FinalRow)
When i hover my mouse over to 'FinalRow', the value is 0.
Please advice me.
I'm using excel 2003
Thank you
Shie Boon