98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft VBA Training and help » Formatting
Formatting
Resolved · Low Priority · Version 2003
Laura has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Formatting
Excel only allows 3 condiditonal formats. Is there a way in VBA to have more than this?
RE: Formatting
Hi Laura,
Thank you for your question.
I have typed some code below to show you how to add more than three conditions to a range of cells:
Range("H10:H529").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=10000", Formula2:="=12000"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.ColorIndex = 7
.TintAndShade = 0
End With
If you then copy and paste this code and change the conditions such as the range of the numbers or the Operator(> < etc.)
In the VBA window use Help to see the ColorIndex numbers.
I hope this answers your question.
Tue 1 Sep 2009: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
VBA tip:Use GoTo to Select A Cell With VBATo select a certain cell on a Worksheet you can use: |