Hi all -
I've searched pretty extensively for this without luck. I will admit to not fully understanding the rules for arrays and data types in VBA, though. What I'm trying to do is this:
INSTEAD of typing all this out....
Dim abc as Range
Set abc = Range(....)
Dim def as Range
Set def = Range(....)
Dim ghi as Range
Set ghi = Range(....)
...I'm simply trying to do it like this....
rA = Array("abc", "def", "ghi")
For i=0 to 2
Dim rA(i) as Range '<------ (constant expression required ERROR OCCURS HERE)
Set rA(i) = Range(....)
MsgBox (rA(i)) '<------- (this works fine)
Next i
... but I get the "Compile error: Constant expression required" problem - even though the loop is successfully grabbing each element of Array rA() as expected (e.g., if I put "MsgBox (rA(i))" inside the loop, it happily displays each member in turn).
Thanks for any help.
Bookmarks