I have a macro that is suppossed to import saved data from one xlsm file to another
when running the macro I get
Run-time error '9':
Subscript out of range
when hitting debug on the dialog
RowBounds = Workbooks(OldSheet).Worksheets("Saved Characters").[a1].Value
is highlighted
For reference Worksheets("Saved Characters").[a1] is a CountA function
When hitting help to discover the nature of the error message it tells me that I have exceeded the bounds of an array or have not specified the number of elements in the array
However I haven't created an array
when running the macro I get
Run-time error '9':
Subscript out of range
when hitting debug on the dialog
RowBounds = Workbooks(OldSheet).Worksheets("Saved Characters").[a1].Value
is highlighted
For reference Worksheets("Saved Characters").[a1] is a CountA function
Code:
Sub Import()
Dim OldSheet As String
Dim RowCount As Long
Dim ColumnCount As Long
Dim RowBounds As Long
OldSheet = Application.GetOpenFilename("Character Sheet Files (*.xlsm), *.txt")
RowBounds = Workbooks(OldSheet).Worksheets("Saved Characters").[a1].Value
For RowCount = 2 To RowBounds
For ColumnCount = 1 To 329
ThisWorkbook.Worksheets("Saved Characters").Cells(RowCount + ThisWorkbook.Worksheets("Saved Characters").[a1].Value, ColumCount) = Workbooks(OldSheet).Worksheets("Saved Characters").Cells(RowCount, ColumCount)
Next
Next
End Sub
When hitting help to discover the nature of the error message it tells me that I have exceeded the bounds of an array or have not specified the number of elements in the array
However I haven't created an array