Change sheet tab color in formula

G

Gary

I would like to change the color of the tab to red when a certain cell
in that sheet has a balance >0. Is there a way of doing this in VBA???
Using Excel 2002...

Thanks very much

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
R

Ron de Bruin

Hi Gary

You can use this event in the sheet module
This example is working for cell A1

If it is a formula(A1) value then you must use the Calculate event
Post back if you need help then

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If Target.Value > 0 Then
Me.Tab.ColorIndex = 3
Else
Me.Tab.ColorIndex = -4142
End If
End If
End Sub
 
R

Ron de Bruin

Oops

I need glasses

Private Sub Worksheet_Calculate()
If Range("A1").Value > 0 Then
Me.Tab.ColorIndex = 3
Else
Me.Tab.ColorIndex = -4142
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top