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
31,986
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
31,986
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
31,986
Office Version
365
Platform
Windows
Glad to help & thanks for the feedback
 

Forum statistics

Threads
1,081,530
Messages
5,359,347
Members
400,524
Latest member
Excelbat

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top