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
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
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! 😊
 

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
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! 😊
 

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

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! 😊
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,029
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback
 

EXCEL MAX

Active Member
Joined
Nov 11, 2020
Messages
293
Office Version
  1. 2007
Platform
  1. Windows

ADVERTISEMENT

It's great thing when you have more option.
Solution must be somewhere there.
 

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
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:

justjaxi

New Member
Joined
Apr 30, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Thank you everyone, the DisplayFormat worked perfectly.
 
Last edited by a moderator:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,029
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,755
Messages
5,597,929
Members
414,193
Latest member
bb60

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
Top