stranno
08-29-2022, 06:19 AM
HI,
What is the difference between arr1 and arr2?
And why does the code" arr2(1,1).select throw an error?
I'm not very surprised by this, but why? After all, arr2(1,1) is a range object right?
And it is allowed to store range objects in a variant array.
Sub Test()
Dim arr1 As Variant, arr2 As Variant
Dim ws As Worksheet
Set ws = ThisWorkbook.ActiveSheet
arr1 = ws.Range("A1:C10").Value 'Values only
arr2 = ws.Range("A1:C10") 'The range object itself (at least i hoped so)
'This causes an error. I am not surprised
arr2(1, 1).Select
End Sub
Thank you so much for any comment.
Stranno
What is the difference between arr1 and arr2?
And why does the code" arr2(1,1).select throw an error?
I'm not very surprised by this, but why? After all, arr2(1,1) is a range object right?
And it is allowed to store range objects in a variant array.
Sub Test()
Dim arr1 As Variant, arr2 As Variant
Dim ws As Worksheet
Set ws = ThisWorkbook.ActiveSheet
arr1 = ws.Range("A1:C10").Value 'Values only
arr2 = ws.Range("A1:C10") 'The range object itself (at least i hoped so)
'This causes an error. I am not surprised
arr2(1, 1).Select
End Sub
Thank you so much for any comment.
Stranno