Worksheet tabs to turn colors against criteria

N

Neall

I want my sheet tabs to change color depending on the date. on the sheet

Example, each sheet represents a customer when the customer is yup for
renewal in less than 90 days to turn red, between 91 and 180 days turn orange
and beyond 180 days to turn green.

Can someone help me with this?

Neall
 
F

FSt1

hi
this should work. it assumes that the date in in A2. if not change that.
post back if you need help installing.
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
If sh.Range("A2").Value < Now + 90 Then
sh.Tab.ColorIndex = 3
Else
If sh.Range("A2").Value > Now + 90 And _
sh.Range("A2").Value < Now + 180 Then
sh.Tab.ColorIndex = 45
Else
If sh.Range("A2").Value > Now + 180 Then
sh.Tab.ColorIndex = 4
End If
End If
End If
Next sh
End Sub

regards
FSt1
 
N

Neall

Perfect Thanks!
--
Neall


FSt1 said:
hi
this should work. it assumes that the date in in A2. if not change that.
post back if you need help installing.
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
If sh.Range("A2").Value < Now + 90 Then
sh.Tab.ColorIndex = 3
Else
If sh.Range("A2").Value > Now + 90 And _
sh.Range("A2").Value < Now + 180 Then
sh.Tab.ColorIndex = 45
Else
If sh.Range("A2").Value > Now + 180 Then
sh.Tab.ColorIndex = 4
End If
End If
End If
Next sh
End Sub

regards
FSt1
 
N

Neall

I think I spoke to soon, the tab color seems to take on the color of the
current tab, each sheet has its own date in the same cell (b1) I want the
color to change depending on its own worksheet.

I have about 125 tabs

Hope you can help and thanks in advance
 

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