Using Collections

  • Thread starter Thread starter Kerry
  • Start date Start date
K

Kerry

Hi,
I have 4 collections called c2, c3, c4 and c5. I want to
cycle through (and perform actions on) all the items
contained in each collection. How do I do this? Is
there a way to make a collection of my collections?

Thanks,
Kerry
 
Kerry,

You can create a collectionof collections, and then do a double
For loop to loop through all the items. For example,

Dim Coll As Collection
Dim V As Variant
Dim All As Collection
Set All = New Collection

All.Add C1
All.Add C2
All.Add C3
All.Add C4
All.Add C5

For Each Coll In All
For Each V In Coll
Debug.Print V
Next V
Next Coll


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top