How to Change Tab Color in Excel with VBA

Changing tab color of Excel is somehow useful. With VBA, it is easily programmed, as far as one can use the macro recorder to see the correct way to do it. However, if you need to change the color of multiple tabs, then you should simply loop over the tabs.

The basic available theme colors for the tab are the following 12:

However, with the .Color property, the tab colors can be increased to 256^3, which is quite above the level that an average user would ever need.

This is a quick way to color the first 5 tabs on a different color:

And if you want to put make all the worksheets in the same color, then simply, change the code to the line below. It would be navy blue:

Pretty much this is all. If you are wondering how to create 100 tabs with 100 different colors, this is a possibility:

The *20000 is used to randomize a bit the colors on the next sheet. That’s all! 🙂

About

VBA Developer

Tagged with: , ,