ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional format if difference in cell values greater than 0.50% (https://www.excelbanter.com/excel-programming/447986-conditional-format-if-difference-cell-values-greater-than-0-50%25.html)

Sabosis

Conditional format if difference in cell values greater than 0.50%
 
Hello-

I am trying to conditionally format a call using VBA if the value of the cell is equal to or greater than 0.50% based on another cell.

if cell b2 = 2.50%
and cell c2 = 1.85%
then I would want b2 highlighted red as the increase amount is over .50.

Thanks

Scott

Auric__

Conditional format if difference in cell values greater than 0.50%
 
Sabosis wrote:

I am trying to conditionally format a call using VBA if the value of the
cell is equal to or greater than 0.50% based on another cell.

if cell b2 = 2.50%
and cell c2 = 1.85%
then I would want b2 highlighted red as the increase amount is over .50.


Depends on what you mean by "highlighted". If you mean "the cell gets filled
with red", use this:

If (Range("B2").Value - Range("C2").Value) 0.005 Then
Range("B2").Interior.Color = vbRed
End If

If you mean "the text is turned red", use this:

If (Range("B2").Value - Range("C2").Value) 0.005 Then
Range("B2").Font.Color = vbRed
End If

If you mean *anything else*, please clarify.

--
Some days you're the pigeon, some days you're the statue.
-- Steven Tyler


All times are GMT +1. The time now is 03:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com