Auto Chg Tab Color vs Current Month

G

Guest

Excel2003 ... I have 12 WorkSheets (1 for each month) ... WorkSheets are
titled ... Jan, Feb, Mar ... etc etc (all are Mmm)

All WorkSheet Tabs are formatted same color ... Is it possible to have Tab
of Current Month "selected" & "set to a different color" upon opening of the
WorkBook?

ie: All Tabs are GREEN ... & it is March ... Upon opening the WorkBook I
would like "Mar" Tab selected ... & ... I would like "Mar" Tab to be set @ a
different color ... say YELLOW. (Of course when April comes "Mar" Tab now
needs to go back to GREEN & "Apr" Tab now needs to be YELLOW)

I am assuming if above is possible it will require a Macro ... If so, since
I know nothing about Marcros (I record only) ... then I will need a Macro
that I can easily edit to suit my application ...

As always ... my extended appreciation to those of you that continually
monitor, support & provide so much guidance on these boards ... Thanks ...
Kha
 
G

Guest

Hi Ken:

Just put your sheets in order with jan as the first and dec as the last.
Then insert this in Workbook code:


Private Sub Workbook_Open()
For i = 1 To 12
ActiveWorkbook.Sheets(i).Tab.ColorIndex = 50
Next
j = Month(DateValue(Now()))
ActiveWorkbook.Sheets(j).Tab.ColorIndex = 6
End Sub

This approach will work regardless of the date format chosen for the tabs.

REMEMBER: workbook code
 
G

Guest

Gary ... (Happy afternoon)

Ok ... I need a slight tweak ... I have 2 WorkSheets in front of the 12
(Mmm) Tabs that I do not want impacted by this Macro ... Thanks ... Kha
 
G

Guest

easy:

Private Sub Workbook_Open()
For i = 3 To 14
ActiveWorkbook.Sheets(i).Tab.ColorIndex = 50
Next
j = Month(DateValue(Now())) + 2
ActiveWorkbook.Sheets(j).Tab.ColorIndex = 6
End Sub

only two lines changed
 
G

Guest

Gary ... (Hi)

Yes ... almost there ... However, I would also like Excel to select the
appropriate Mmm Tab when opening (part of original post) ... (ie: someone
opens ... they open to current Mmm Tab) ... Thanks ... Kha
 

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