Set few range variables at once
Greg,
I would rethink my approach here. You have 50 separate variables, each of which require celaration and assignment: this is not
really "loopable" as it stands.
A better approach might be to create a small function to return a range based on a State name, or to use a dictionary object to
associate names and ranges.
All depends to some extent (performance-wise) on what you're going to do with those 50 variables...
Tim
--
Tim Williams
Palo Alto, CA
"Greg" wrote in message ...
Hi,
Is there a way to do the below implicitly in a loop or as array? Thank you!
Dim States As Range
Dim Alaska As Range, Alabama As Range, Arizona As Range 'etc
Set States = Range("a2:a51")
With States
Set Alaska = .Cells.Find("Alaska", lookat:=xlWhole, MatchCase:=False)
Set Alabama = .Cells.Find("Alabama", lookat:=xlWhole, MatchCase:=False)
'...
'..
'etc
End With
--
______
Regards,
Greg
|