Add color to worksheet tab

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Good Morning All,
Using Windows XP and Excel XP.

I have a workwork that contains 31 sheets (one for each day of the month)
and I have it programmed to open up
to the previous days date. For example if I open the January workbook it
would open up sheet Jan30. Here is the
code to do that:
Private Sub Workbook_Open()
On Error Resume Next
Sheets(Format(Date - 1, "mmmd")).Activate
On Error GoTo 0

How can I add for the active sheet tab to be colored red, while the rest
have no color?

Thank you in advance,

Michael
 
Hi Mike

something like:
---
For Each ws In Sheets
ws.Tab.ColorIndex = xlNone
Next
ActiveSheet.Tab.ColorIndex = 3

---
after your code

Hope this helps
Cheers
JulieD
 
Mike here is one way

Private Sub Workbook_Open()
On Error Resume Next
Sheets(Format(Date - 1, "mmmd")).Activate
ActiveSheet.Tab.ColorIndex = 3

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
On Error GoTo 0
 
Thank you for your responses, it works.
Paul B said:
Mike here is one way

Private Sub Workbook_Open()
On Error Resume Next
Sheets(Format(Date - 1, "mmmd")).Activate
ActiveSheet.Tab.ColorIndex = 3

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
On Error GoTo 0
 
Back
Top