ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Collections (https://www.excelbanter.com/excel-programming/289081-using-collections.html)

Kerry[_4_]

Using Collections
 
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

Chip Pearson

Using Collections
 
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



"Kerry" wrote in message
...
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





All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com