VBA Macro to apply conditional formatting

AgentKMK

New Member
Joined
Jul 22, 2018
Messages
9
I would so very much appreciate a solution as this has been driving me nuts for days!

I have applied 12 conditional formatting rules in my sheet, all to the same range. Pretty basic, they are to colour the rows dependent on the project status code entered into column J.


Problem is, when a new row is entered, the conditional formatting range will split into two at that point. Naming the range does not work.

I end up having to strip off then re-apply conditional formats because they tend to “breed" excessively.

Does anyone know of VBA code that will allow me to replace the inbuilt conditional formatting?

At present my rules are applied to range $A$3:$AH$117 (but obviously as rows are added the last row number would increase from 117 to 118 to 119 and so on.
Formula = $J3=$B$123
Formula = $J3=$B$124
Formula = $J3=$B$125
Formula = $J3=$B$126
Formula = $J3=$B$127
Formula = $J3=$B$128
Formula = $J3=$B$129
Formula = $J3=$B$130
Formula = $J3=$B$131
Formula = $J3=$B$132
Formula = $J3=$B$133
Formula = $J3=$B$134

All text is black, the colours are shown in the attached image.
Project%20Status.png


$B$123:$B$134 is actually a range named Project_Status.

I am also after VBA code that inserts a thick red border at the bottom of any row where the data in the row below, based on what is in column A, is different. Once again applied to the range $A$3:$AH$117.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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