When we prepare a report or a dashboard it is easy to identify or analyze reports with a change of color sheet tabs. Analysts generally give the same color to the tabs which are related to same function.ย
For example if you are preparing a dashboard for all the departments in an organization. All the worksheet tabs related finance can be highlighted in red, HR can be in Blue, etc. so with this report looks good and is easy to understand.
We can change the Worksheet tab colors by setting the Tab.ColorIndex property using Excel VBA.
This Example will show you how to change the Color of Sheet tabs using Excel VBA. In the following Example we are changing the Sheet2 tabs color to Red. Lets have a look
Sub redColorSheetTab() Sheets("Sheet2").Tab.ColorIndex = 3 '3=Red, 4=green, 5=blue,6=yellow etc. End Sub
Here is another help code for programmers to change the color of Excel sheet tab. I have shown another way to achieve this:
'This function changes the tab color of a sheet
Sub ChangeSheetTabColor()
ย ย ย '
ย ย ย 'Option 1 - using standard colors vbGreen, vbRed, vbBlack, vbYellow, vbBlue, vbWhite etc.
ย ย ย Sheet1.Tab.Color = vbGreen
ย ย ย '
ย ย ย 'Option 2 - using RGB colors
ย ย ย Sheet1.Tab.Color = RGB(117, 117, 117)
ย ย ย '
End Sub
You may have noticed that in Option 2, I have used RGB function to change the sheet tab color. You mayย read this postย to know more about how to get RGB codes of a color.
If you need to change the color of the tab you are currently viewing, you can use the following VBA macro code along with your desired RGB color code:
Sub ChangeTabColor()
'Objective: Change Selected Tab To Specific Color
ActiveSheet.Tab.Color = RGB(25, 25, 25)
End Sub
If you need to write a VBA loop to ensure all worksheet tabs have their color removed, you can use a macro similar to the below code:
Sub ClearAllTabColor()
'PURPOSE: Remove Tab Color from all Sheets
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Tab.Color = xlNone
Next sht
End Sub
To help you practice this code, we have made this code available through practice file. Click on the below link to download the practice file.
Outlook Bulk Email Tool is an Excel and Outlook based tool which helps you to send or draft email in bulk right from Excel. It reads the recipient details from Excel sheet and uses Outlook installed on your system to generate emails. The tool supports To, Cc, Subject, Email Body, Attachment, HTML Table in Email Body.
This tutorial shows you three easy ways to add hyperlinks in Excel. You will learn how to insert, change, and remove hyperlinks in your worksheets. It also explains how to fix links that donโt work.
Hyperlinks are often used on the internet to move between websites. In Excel, you can create links like that too. You can make a link to another cell, a different sheet, or even another workbook. You can also link to open a new Excel file or start an email message. This guide will show you how to do all of this in Excel 2016, 2013, 2010, and older versions.
Free File Renamer Tool – Quickly Rename files batch using Excel VBA Here is another help code and tool for programmers to rename files. You can use this tool for renaming all files available in…
Did you come across any requirement where you want the user to interact with a sheet only through VBA Form? Here is a simple code which can help you.
Time & Motion Tracker is an MS Excel based tool which helps you to track Start and End time of any type of transaction or activity. The tool is developed using VBA coding which helps you to protect manual manipulation in the data by the user. It is also easy to use, just click on Start (shortcut: Ctrl+Shift+A) or Stop (Ctrl+Shft+S) buttons to record the time stamp.
Have you ever got into situation in office where you need to count the cells in Excel sheet with specific color? If yes then you can use following code which counts the number of cells…