Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro to change row and font color based on column value
I have a worksheet which I need to change the font color and row color
for a portion of the cells in a row. For example I have data in the first five columns of a row, the sixth column is the column which influences the change (data is text), then I have data in columns seven though ten which will need to be changed based on column six, finally there is columns eleven through fourteen which are not effected by the change. I have been able to get the entire row to change but I can not get only the portions I want to change. Also column six is a list so initially it is blank but when I select a value that is when the change takes place. Thanks for your help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro to change row and font color based on column value
Maybe
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 6 And Target.Count = 1 Then If Target.Value = "Criteria for change" Then With Range(Cells(Target.Row, 7), Cells(Target.Row, 10)) .Font.ColorIndex = 2 .Interior.ColorIndex = 15 End With End If End If End Sub This is worksheet event code. Right click the sheet tab, select View Code and paste the code in there. Hope this helps Rowan "MT" wrote: I have a worksheet which I need to change the font color and row color for a portion of the cells in a row. For example I have data in the first five columns of a row, the sixth column is the column which influences the change (data is text), then I have data in columns seven though ten which will need to be changed based on column six, finally there is columns eleven through fourteen which are not effected by the change. I have been able to get the entire row to change but I can not get only the portions I want to change. Also column six is a list so initially it is blank but when I select a value that is when the change takes place. Thanks for your help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro to change row and font color based on column value
place this in the worksheet change event (thisworkbook module)
this will test a change Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range) if target.column= 10 then If Target = "1" Then For i = 1 To 3 Cells(Target.Row, Target.Column).Offset(0, i).Interior.ColorIndex = 14 Next i End If If Target = "" Then For i = 1 To 3 Cells(Target.Row, Target.Column).Offset(0, i).Interior.ColorIndex = xlNone Next i End If end if End Sub hth steve On 31 Aug 2005 21:22:41 -0700, "MT" wrote: I have a worksheet which I need to change the font color and row color for a portion of the cells in a row. For example I have data in the first five columns of a row, the sixth column is the column which influences the change (data is text), then I have data in columns seven though ten which will need to be changed based on column six, finally there is columns eleven through fourteen which are not effected by the change. I have been able to get the entire row to change but I can not get only the portions I want to change. Also column six is a list so initially it is blank but when I select a value that is when the change takes place. Thanks for your help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro to change row and font color based on column value
Thanks I will give this a try
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro to change row and font color based on column value
Thanks I will try both and let you guys know.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change font color based on a value | Excel Worksheet Functions | |||
how do i change row font color based on cell value in that row | Excel Worksheet Functions | |||
How do you change font color based on the value input? 1 = |
Excel Discussion (Misc queries) | |||
Excel - Hide Column/s or Change Font color Only for printing | Excel Discussion (Misc queries) | |||
Change Font Color Based on Classification | Excel Discussion (Misc queries) |