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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

svendiamond

Well-known Member
Joined
Jun 13, 2014
Messages
1,504
Office Version
  1. 365
Platform
  1. Windows
I'm not sure about how to edit your macro but why not just use conditional formatting? Have you already explored that option?
 

Stout

New Member
Joined
Jun 1, 2015
Messages
8
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,387
Messages
5,836,964
Members
430,464
Latest member
nickburrett

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
Top