I have a VBA collection that contains several File items (I created a class module called File with several properties). I was curious if there is a way to use a For
loop to iterate through all the items in the collection and do two things:
- Get a list of all unique items based on a File property that I specify
- Count the number of items that match each unique value from the above list
For example, let's say I have 4 File items in my collection:
- File1 (File1.Pattern = "Test*.xlsx")
- File2 (File2.Pattern = "Test*.xlsx")
- File3 (File3.Pattern = "Test*.txt")
- File4 (File4.Pattern = "Test*.csv")
The output I would want would be (ideally an array or separate collection):
- Test*.xlsx (2)
- Test*.txt (1)
- Test*.csv (1)
Any thoughts on how I might implement something like this?