change sheet tab color

dani1

Board Regular
Joined
Mar 23, 2010
Messages
90
hi experts!

how can i change all sheet tab colors using a macro?i need one color on all sheets using a macros.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Would it not be simpler to select the first tab, hold the Shift key and click the last tab, then right-click any tab, select Tab Color, ...
 
Upvote 0
Place this code in the ThisWorkbook module.

Code:
[COLOR=darkblue]Sub[/COLOR] ChangeTabColour()
   [COLOR=darkblue]Dim[/COLOR] ws [COLOR=darkblue]As[/COLOR] Worksheet
 
   [COLOR=darkblue]For[/COLOR] [COLOR=darkblue]Each[/COLOR] ws [COLOR=darkblue]In[/COLOR] ThisWorkbook.Worksheets
      ws.Tab.ColorIndex = 6   [COLOR=green]'yellow[/COLOR]
   [COLOR=darkblue]Next[/COLOR] ws
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]

See here for colour index chart
http://www.mvps.org/dmcritchie/excel/colors.htm
 
Upvote 0
This will color all WorkSheet tabs red:
Code:
Sub ColorAllTabs()
Dim Sht As Worksheet
    For Each Sht In ThisWorkbook.Sheets
        Sht.Tab.ColorIndex = 3
    Next Sht
End Sub
This will clear all tabs of Color:
Code:
Sub ClearAllTabs()
Dim Sht As Worksheet
    For Each Sht In ThisWorkbook.Sheets
        Sht.Tab.ColorIndex = xlNone
    Next Sht
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,390
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top