![]() |
Auto Chg Tab Color vs Current Month
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 |
Auto Chg Tab Color vs Current Month
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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 |
Auto Chg Tab Color vs Current Month
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 "Gary''s Student" wrote: 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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 |
Auto Chg Tab Color vs Current Month
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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 "Gary''s Student" wrote: 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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 |
Auto Chg Tab Color vs Current Month
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 "Gary''s Student" wrote: 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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 "Gary''s Student" wrote: 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 -- Gary''s Student gsnu200710 "Ken" wrote: 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 |
All times are GMT +1. The time now is 02:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com