Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Row Colours
Hi
I'm looking for a VBA script to colour all the cells in a row (or even just some in a row) a certain colour dependent on the value in the 'A' column cell. For instance, if cell A1 is Jan-03 then the whole row should be coloured light yellow (or whatever the RGB equivalent is); if cell A2 is Feb-03 then the whole row should be coloured light green; and so on... Is this possible? Thanks for you help. Rob |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Row Colours
For up to 3 colors you would use Conditional Formatting,
no VBA code involved. http://www.mvps.org/dmcritchie/excel/condfmt.htm For more than 3 colors as I think you have, and specifically because you asked for VBA see http://www.mvps.org/dmcritchie/excel/event.htm#case --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Rob" wrote in message ... Hi I'm looking for a VBA script to colour all the cells in a row (or even just some in a row) a certain colour dependent on the value in the 'A' column cell. For instance, if cell A1 is Jan-03 then the whole row should be coloured light yellow (or whatever the RGB equivalent is); if cell A2 is Feb-03 then the whole row should be coloured light green; and so on... Is this possible? Thanks for you help. Rob |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Row Colours
Rob,
Select all the rows Goto menu formatConditional Formatting Change Condition 1 to Formula Is Add a formula of =$A1=DATE(2003,1,1) Click Format Select the Patterens tab, choose the colour OKI Click Add Change Condition 2 to Formula Is etc. OK -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Rob" wrote in message ... Hi I'm looking for a VBA script to colour all the cells in a row (or even just some in a row) a certain colour dependent on the value in the 'A' column cell. For instance, if cell A1 is Jan-03 then the whole row should be coloured light yellow (or whatever the RGB equivalent is); if cell A2 is Feb-03 then the whole row should be coloured light green; and so on... Is this possible? Thanks for you help. Rob |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Row Colours
Rob,
Sub testit() Dim i As Long, lngLastRow As Long With Sheet1 lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row For i = 1 To lngLastRow Select Case .Cells(i, 1) Case CDate("1-Jan-03"): .Rows(i).Interior.ColorIndex = 36 Case CDate("1-Feb-03"): .Rows(i).Interior.ColorIndex = 35 End Select Next End With End Sub Rob "Rob" wrote in message ... Hi I'm looking for a VBA script to colour all the cells in a row (or even just some in a row) a certain colour dependent on the value in the 'A' column cell. For instance, if cell A1 is Jan-03 then the whole row should be coloured light yellow (or whatever the RGB equivalent is); if cell A2 is Feb-03 then the whole row should be coloured light green; and so on... Is this possible? Thanks for you help. Rob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional Formatting / Cell Fill Colours | New Users to Excel | |||
how do i get more than 3 colours in conditional formatting | Excel Discussion (Misc queries) | |||
colours missing in conditional formatting. | Excel Worksheet Functions | |||
Conditional Formatting with Colours / Colors | Excel Worksheet Functions | |||
is it possible to have more than 3 colours in conditional format | Excel Worksheet Functions |