VBA Conditional Formatting

Lord_B

New Member
Joined
Oct 17, 2018
Messages
19
Hi,

Thanks again for taking time to look at this.

What I am trying to do is change the colour of the above cell depending if an S is in the below cell.

I already have a vlookup formula in the above cell which depending on the value will change colour.

This is easy to do with conditional formatting but the issue with that is I have a range from D1 to UD207 which means there will be 38,500 entries.

So the question is, is there a way to do this with VBA?

Thanks for all your help.

Ben
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
This is easy to do with conditional formatting but the issue with that is I have a range from D1 to UD207 which means there will be 38,500 entries.
It is just as easy to apply Conditional Formatting to a whole range of cells as it is to apply it to one cell.
Just select the whole range you want to apply it to, and write the Conditional Formatting formula as it applies to the very first cell in your selection.
As long as you code your absolute/relative cell references correctly, the Conditional Formatting formulas will automatically adjust for all the others.
 
Upvote 0
So, if you wanted to highlight a cell if the cell below it is an "S", just select your whole range (D1:UD207) and enter this CF formula:
Code:
=D2="S"
and choose your formatting color.

The CF rule with then be applied to all the cells in your selection, and every cell will look at the cell just below it.
 
Last edited:
Upvote 0
Hi Joe4,

I just face palmed myself for trying to over complicate it!

Thanks for the above :). great example.

Must remember KISS, Keep It Simple Stupid.

Thanks again.

Ben
 
Upvote 0
You are welcome.
Glad I was able to help!
:)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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