0
votes

I need to change the background color of a certain range of cells based on a list of values (9 possible) in a single cell. I want the background change to happen across multiple different tabs.

Range of Cells: Tab 1(A1:L1, A3:L3, A33:L33) Tab 2(A1:X1, Column C) Tab 3(A1:M1, D5:G5, Column D, Column, G) There are many more, but I think if I see how it's done, I can play with the code enough to make it work!

Cell: Tab 2(B3)

Values: 'The Reach' = green, 'The North' = light grey, 'The Iron Islands' = dark grey, 'The Riverlands' = dark blue, 'The Vale' = light blue, 'The Crownlands' = dark red, 'The Westerlands' = red, 'The Stormlands' = gold, 'Dorne' = orange

To be honest, the colors don't matter. If you can make the code, I can just tweak the background colors with specific hex code. Also, if possible, could text color be changed as well?

I'm not sure how to begin this, as I have no expertise coding. Would any of you be able to help? Sorry if this is a lot work, I just have NO idea.

This is the sheet I'm working with. I basically just want to change the headers when the region changes.

2
@pnuts, Thought it was relevant? I have no idea. Sorry!Raawx
@hbrmstr, it needs to be a separate code. It doesn't allow me to change entire rows. Only the singular cell, unfortunately.Raawx

2 Answers

0
votes

If you just want to trigger colors changes, I would give the built-in conditional formatting a try first. If you need help formulating a statement after reviewing that, there's already numerous examples / threads in the official Docs Product Forum that use the "Custom formula is" box.

At this point, the only reason to get a script involved is to trigger some thing more advanced to happen when your cell value changes like sending an email or moving a row.

0
votes

This is just a 'general guide' (ie I can't be bothered to set up and explain nine different colours in three different tabs and multiple ranges). First give B3 in Holdfast Information a name - say Region. Then apply a conditional formatting rule to Income Row 2 of say:

Custom formula is =row()=2 Format: Text Colour: Black, Range: 2:2.

(To allow the next rule to apply to A1:L3.) Then:

Custom formula is =indirect("Region")="The Westerlands" Format: Text Colour: of your choice, Background Colour: Red, Range: A1:L3.

As an aside, you should perhaps be applying a lookup rather than that horrible formula in B3.