Thread: tab color
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
briank briank is offline
external usenet poster
 
Posts: 31
Default tab color

Thank you. It works gr8!

"Rob van Gelder" wrote:

Right-click the Tab, View Code, Paste this code

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.WorksheetFunction.CountA(Range("A1:A50 ")) = 1 Then
Target.Parent.Tab.ColorIndex = 3
Else
Target.Parent.Tab.ColorIndex = 5
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"briank" wrote in message
...
I would like to alter the color of the tab based upon a value in an array
of
cells. In my example if the range is A1:A50 and just one cell has a number
in
it then this will cause the tab to change color. Here is some code that I
found but cannot get it to work. Any suggestions?
i.e.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Address = "$A$1..$A$50" Then
If Target.Value0 Then Sh.Tab.ColorIndex = 3
End If
End Sub