How to Color cell in one row if cellvalue is higher or lower than specific number?

Stout

New Member
Joined
Jun 1, 2015
Messages
8
as the title said i want to know how to use a macro to Color a cell in one row if the cell value is higher or lower than specific number.

for the moment i have this

Dim myLastRow As Long
myLastRow = Range("D65536").End(xlUp).Row
Range("B" & myLastRow + 1).Resize.FormulaR1C1 = "=COUNTIF(R[" & -myLastRow & "]C:R[-1]C,""<1"")"


Range("D" & myLastRow + 1).Resize(, 42).FormulaR1C1 = "=COUNTIF(R[" & -myLastRow & "]C:R[-1]C,"">4"")"


Range("AT" & myLastRow + 1).Resize(, 76).FormulaR1C1 = "=COUNTIF(R[" & -myLastRow & "]C:R[-1]C,"">5"")"

i want the cell to become red if its go higher than zero and if it stays at zero i want it to become green.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I'm not sure about how to edit your macro but why not just use conditional formatting? Have you already explored that option?
 
Upvote 0
that would probably work but as i have to use this macro every day, it would take time to do that from other things i could be working on.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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