condition format - greater than and lower than

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

Can you help on this please as I have brain freeze

I want this VBA line of code to say = "=$F10 >4 but <8

[With Range("$F$10:F" & LR)
.Select
.FormatConditions.Add Type:=xlExpression, Formula1:="=$F10>6"
.FormatConditions(.FormatConditions.Count).Interior.Color = RGB(153, 255, 102)
End With]
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Change this line:
VBA Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=$F10>6"
to this:
VBA Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=AND($F10>4,$F10<8)"
 
Upvote 0
Solution
Change this line:
VBA Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=$F10>6"
to this:
VBA Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=AND($F10>4,$F10<8)"
that's great, thank you very much
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,215,087
Messages
6,123,046
Members
449,092
Latest member
ikke

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