rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 576
- Office Version
- 365
- Platform
- Windows
I have a range of cells that spans a block of columns, but there is a blank column in between each of the columns of data. I want to start at the top left most cell and have it go down to the bottom of that column and the over to the right to the next block of cells 2 columns over. Then down and over until it has reached the last cell in the block. The goal is to find the first cell that does not have any color in it and then apply the desired color to that cell and then exit the sub. My code is listed below and when I run it, it moves to the first cell in the range and then displays "Done" indicating that the macro has run, but nothing happens. No cells had their interior color changed. What am I doing wrong and how do I fix it?
VBA Code:
Sub COLOR_ME()
Dim Cell As Range
For Each Cell In Range("AC4:AC7,AE4:AE7,AG4:AG7,AI4:AI7,AK4:AK7")
If Cell.Interior.Color = xlNone Then
ActiveCell.Interior.Color = RGB(75, 205, 255)
Exit Sub
End if
Next Cell
MsgBox "Done"
End Sub