rahulkumar88
New Member
- Joined
- Apr 9, 2011
- Messages
- 16
Hi
I need to store the given range in a spreadsheet in an array. Can you please tell me why this code doesn't work and the solution to the problem as well.
Sub test()
Dim result() As Variant
For i = 1 To cells(1,1).end(xldown).row
For j = 1 To cells(1,1).end(xltoright).column
result(i, j) = Cells(i + 1, j + 1).Value
Next j
Next i
End Sub
Thanks
I need to store the given range in a spreadsheet in an array. Can you please tell me why this code doesn't work and the solution to the problem as well.
Sub test()
Dim result() As Variant
For i = 1 To cells(1,1).end(xldown).row
For j = 1 To cells(1,1).end(xltoright).column
result(i, j) = Cells(i + 1, j + 1).Value
Next j
Next i
End Sub
Thanks