Code:
Sub Test2()
Dim MYCELL As Object
myColor = ActiveSheet.Range("A1").Interior.ColorIndex
For Each MYCELL In ActiveSheet.UsedRange
If (MYCELL.Interior.ColorIndex = myColor) Then myArray = MYCELL.Address
Next MYCELL
End Sub
I am trying to load all Cell Addresses into MyArray that has the Interior.ColorIndex of A1 so I can use My Array later on in my code.
Stepping through the code, I see that myArray is reading each cell that, in this case has the Index no. 35.
I just don't know how to store all the cells together.
My UsedRange is A1:Q31 and I have two different Cell colors. About half of them will be the Index number I'm looking for.
Any help appreciated.
Thanks