View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Create a collection of ranges

What I would like to do is:
For Each r in rColl


Hi. Just throwing this out. Is the "Areas" the property you were looking
for?

Sub Demo()
Dim RngColl As Range
Dim r As Range
Set RngColl = Range("A1:D1, E40:R40, T120:AA120")

For Each r In RngColl.Areas
r.Select 'or Clear, or whatever...
Next
End Sub

--
Dana DeLouis
Windows XP & Office 2003


"Gary''s Student" wrote in message
...
What is the syntax to create a collection of ranges? Currently I use an
array of strings:

Sub dural()
s = Array("A1:D1", "E40:R40", "T120:AA120")
For i = LBound(s) To UBound(s)
Range(s(i)).Clear
Next
End Sub

What I would like to do is:

rColl = whatever
dim r as Range
For Each r in rColl
r.Clear
Next
--
Gary''s Student