View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
CR[_2_] CR[_2_] is offline
external usenet poster
 
Posts: 50
Default Change Cell color

Mike, I'm sorry. I forgot to say that All of the cells in the row have to
have xlNone before the first one's color index is changed. Once it finds a
cell with a different color it can go to the next row.

CR



"CR" wrote in message
...
The Color index is not Conditional formatting.

Mike, It does not seem to work as planned.
I looks like it is offsetting -1 from the first cell that has xlNone, not
from the first cell in the row.
The cell directly next to every cell that is xlNone gets the new color
index.

CR



"Mike H" wrote in message
...
Hi,

Maybe this

Sub CheckColour()
For Each c In Range("F75:F100")
If c.Resize(, 15).Interior.ColorIndex = xlNone Then
c.Offset(, -1).Interior.ColorIndex = 5
End If
Next
End Sub

Mike

"CR" wrote:

Could someone please show me the code, I still have trouble setting up a
simple loop.
I have tried to adapt other code I have, but no luck.

In a range E75:T100

If the cells in F75 to T75 have a colorindex value of xlNone then
Cell E75 has a colorindex value = 5

Do the next row

Thank you