Pulling color choice for whole workbook from one cell in one sheet

Skramp

New Member
Joined
Mar 26, 2019
Messages
4
Basically, what I want to do is have one cell on the first of 8 sheets be the decider for all 8 sheets. Like you pick the cell color in M8 on the first page and that color is carried over to the appropriate spots on all 8 pages. But, I want this to be automated, like once it's selected its applied.

I have this VBA that I can use for each page to make it happen, but forces you to select the color on in M8 on each sheet instead of just the first one.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("A8").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("D8").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("G8").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("A17").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("D17").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("G17").Interior.Color = Me.Range("M8").Interior.Color
Me.Range("A26").Interior.Color = Me.Range("M8").Interior.Color
End Sub

I have that set for each page, but it seems somehow I just need one for the whole workbook that references cell M8 on sheet 1.

Any thoughts or ideas?

Thanks
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,378
Office Version
365
Platform
Windows
How about
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim Ws As Worksheet
    For Each Ws In Worksheets
        Ws.Range("A8,D8,G8,A17,D17,G17,A26").Interior.Color = Me.Range("M8").Interior.Color
    Next Ws
End Sub
 

Skramp

New Member
Joined
Mar 26, 2019
Messages
4
That doesn't seem to pull the color from only the one cell. The cell I want to reference is M8 on sheet1. But i want sheet7 to pull that same color and fill in those cells also based on what is chosen on Sheet 1. Does that make sense?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,378
Office Version
365
Platform
Windows
If you put the code into sheet1 & remove all similar code from the other sheets, then whenever you select a cell on sheet1 the other sheets will get the cells coloured.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,378
Office Version
365
Platform
Windows
Glad to help & thanks for the feedback
 

Forum statistics

Threads
1,078,137
Messages
5,338,458
Members
399,234
Latest member
WaddoAU

Some videos you may like

This Week's Hot Topics

Top