I m initializing an array and import values from a specific range. if the range are greater than one line the code works fine BUT in case the range is just one line i m getting an error of:
Run time error 13: Type mismatch
Code:
Sub test()
Dim arr As Variant
Dim i As Long, LastRow As Long
With ThisWorkbook.Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
arr = .Range("A1:A"& LastRow)
For i = LBound(arr) To UBound(arr)
Next i
End With
End Sub
Any help will appreciated.
After @JvdV answer i manage to overcome this problem but i face other one:
when there is more than one lines the array looks like that:
But when there is only one line:
How to create the same array structure - dimensions?