View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carim Carim is offline
external usenet poster
 
Posts: 510
Default How can I color only subtotal lines in Excel 2002?

Hi,


Example of an event macro which colors 5 cells to its right if the word
"Subtotal" is entered in the reference range A1:A10 ... Adjust to
your needs

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A10")) Is Nothing Then
Exit Sub
Else
If Target.Value = "Subtotal" Then
Target.Offset(0, 1).Range("A1:E1").Interior.ColorIndex = 6
End If
End If
End Sub

HTH
Cheers
Carim