View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Change formats based on A:A cell value on each row - (not with conditional format!) ?

for i = 6 to 96

If Range("A6")(i).value = "K" then cells
Range("C5:G5").Offset(i,0).ColorIndex = 1
If Range("A6")(i).value = "I" then cells
Range("C5:G5").Offset(i,0).ColorIndex = 2
If Range("A6")(i).value = "R" then cells
Range("C5:G5").Offset(i,0).ColorIndex = 3

Next

--
Regards,
Tom Ogilvy

"Marie J-son" wrote in message
...
Hi,

I need VBA code for this, I can't use the conditional format function of
some reasons.

Let ? = a row between 6 and 96 and cells in same row between column C:G
should have different fonts, colorindex etc depending on what letter there
is in the cell in A column.

If A? = "K" then cells Range("C?:G?").ColorIndex = 1
If A? = "I" then cells Range("C?:G?").ColorIndex = 2
If A? = "R" then cells Range("C?:G?").ColorIndex = 3

Any suggestions?

By the way, the fastest way possible please, the VBA code will be into
worksheet_change. Maybe use "Find" rather than a Loop, maybe?


/Regards