ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate Tab Color (https://www.excelbanter.com/excel-programming/395944-automate-tab-color.html)

Bob

Automate Tab Color
 
hello-

I'd like to make a macro that changes all tabs to red when the file is Saved
As somethings else. Once they are "reset" in a save as mode, they are free
to be changed manually, I just would like to have a script that defaults a
new file to red tabs.

Does anyone on this list have any suggestions of a short script?

regards,
-b o b

joel

Automate Tab Color
 
Add code to thisworkbook page in VBA window

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

For Each ws In Sheets
Sheets(ws.Name).Tab.ColorIndex = 3
Next ws
End Sub


"Bob" wrote:

hello-

I'd like to make a macro that changes all tabs to red when the file is Saved
As somethings else. Once they are "reset" in a save as mode, they are free
to be changed manually, I just would like to have a script that defaults a
new file to red tabs.

Does anyone on this list have any suggestions of a short script?

regards,
-b o b



All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com