Conditional formatting in VBA

kompot

New Member
Joined
Jul 17, 2014
Messages
1
Hi Guys,

I'm new to VBA, so this problem might be not be really difficult, yet I cannot seem to find solution...

I'll just list what I need to do:

1. Conditional formatting needs to be applied to columns P and Q
=$Q1>$P1=> both cells turn red;
=AND($Q1=0,$P1>0) => both cells turn yellow.
2. Formatting needs to be applied only to rows where cell R is not empty (or where cell C is empty)
3. Number of total rows in range might be based on column B

Problem is that my recorded macro works properly only if I specify first cell that formatting needs to be applied to e.g. $Q12>$P12. I have no idea how to solve this...

I'm struggling with this long enough, can anybody help me?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,215,634
Messages
6,125,938
Members
449,275
Latest member
jacob_mcbride

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