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.
|