I tried to create a copy a range into an array, do some thing within
the array and then copy the value back into the range.(codes
attached below)
I kept getting "subscript out of range" error. Can anyone tell me
why?
BTW, array can be up to 100 dimensions. If I want to manipulate a
range with more than 100 columns, do I have to break it down? Is
there another way out?
Codes:
============================================================
Sub RangeToVariant2()
Dim x As Variant
Dim r As Integer, c As Integer, p As Integer
x = Range("A1:C5").Value
For r = 1 To UBound(x, 1)
For c = 1 To UBound(x, 2)
For p = 1 To UBound(x, 3)
If IsNumeric(x(r, c, p)) Then
x(r, c, p) = x(r, c, p) * 2
End If
Next p
Next c
Next r
Range("A1:C5") = x
End Sub
============================================================