Tab Color Change to Cell Color

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Is there a way to make the tab color change with the color of a cell on that worksheet?

Example: Workbook “CUSTOMER CONTACT” has several worksheets. One worksheet is titled “Cold Calls”, another is titled “Mailings”. In cell C1 on the “Cold Calls” worksheet, the cell changes color based on a percentile set from conditional formatting. In cell D5 on the “Mailings” worksheet, the cell changes color based on a specific text set from conditional formatting.

I want the “Cold Calls” tab in my workbook to change colors along with the color on that same worksheet (“Cold Calls”) of cell C1.

I want the “Mailings” tab in my workbook to change colors along with the color on that same worksheet (“Mailings”) of cell D5

If it can be done, do the colors have to be ‘prime’ colors (in other words, no variations of colors, just the set colors allowed)?

etc., etc. etc.

TIA
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello Justjaxi,
Here is some example.
Contitional formating rule must to be same as in the code.
"Sheets("Cold Calls").Range("C1").Value > 0"

View attachment 26850
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   
    Dim varColor As String
   
    varColor = Sheets("Cold Calls").Range("C1").Interior.Color
    If Sheets("Cold Calls").Range("C1").Value > 0 Then
        ActiveWorkbook.Sheets("Cold Calls").Tab _
         .Color = Sheets("Cold Calls").Range("C1"). _
            FormatConditions(1).Interior.Color
    Else
        ActiveWorkbook.Sheets("Cold Calls").Tab _
         .Color = varColor
    End If

End Sub
Thank you! ?
 
Upvote 0
I think Peter was after what makes the change in the Conditional formatting so he could use it to trigger the macro.
As a basic you can make the tab color match the conditional formatting color of a cell like...

VBA Code:
 Sheets("Cold Calls").Tab.Color = Sheets("Cold Calls").Range("C1").DisplayFormat.Interior.Color

but to go any further then we need to know how you are triggering the change to the conditional formatting
Thank you! ?
 
Upvote 0
Another option which will trigger when any cell is changed
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Me.Tab.Color = Range("C1").DisplayFormat.Interior.Color
End Sub
This needs to go in the Cold Calls sheet module.
We can restrict which cells trigger the code if needed.
Thank you! ?
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
It's great thing when you have more option.
Solution must be somewhere there.
 
Upvote 0
Thank you everyone for your help! The
Another option which will trigger when any cell is changed
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Me.Tab.Color = Range("C1").DisplayFormat.Interior.Color
End Sub
This needs to go in the Cold Calls sheet module.
We can restrict which cells trigger the code if needed.
Thank you! This worked perfectly!
 
Last edited by a moderator:
Upvote 0
Thank you everyone, the DisplayFormat worked perfectly.
 
Last edited by a moderator:
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,541
Latest member
iparraguirre89

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