Is there a trick to resizing variant type variables?
I have a pretty simple code
Sub Button1_Click()
Dim y As Variant
y = Range(Cells(1, 1), Cells(2, 4)).Value
ReDim Preserve y(UBound(y, 1), UBound(y, 2) + 1) As Variant
Range(Cells(3, 1), Cells(4, 5)).Value = y
End Sub
the ReDim bit throws an out of scope error. I have to use variant since range.value returns a variant type.
Question
capr
Is there a trick to resizing variant type variables?
I have a pretty simple code
the ReDim bit throws an out of scope error. I have to use variant since range.value returns a variant type.
can you think of a way to fix this? I am reading http://msdn.microsoft.com/en-us/library/office/gg251578.aspx and it says.
"To resize an array contained in a Variant, you must explicitly declare the Variant variable before attempting to resize its array."
I don't know what that means...
Link to comment
Share on other sites
2 answers to this question
Recommended Posts