Forum Discussion
Excel
Jan 03, 2022Iron Contributor
Conditional Formatting VBA
Hello Everyone, With the help of VBA code, If any number is smaller than 25, then it come pink. And if any number is greater than 100 smaller equal than 150, then it come green and If any number i...
Excel
Jan 03, 2022Iron Contributor
Thank you for the solution.
Sir, i want to highlight numbers with the help of VBA code
Sir, i want to highlight numbers with the help of VBA code
HansVogelaar
Jan 03, 2022MVP
If you want conditional formatting:
Sub Macro1()
With Range("B1:B14").FormatConditions
.Delete
.Add(Type:=xlCellValue, Operator:=xlLess, Formula1:="=25").Interior.Color = RGB(255, 63, 255)
.Add(Type:=xlCellValue, Operator:=xlGreater, Formula1:="=100").Interior.Color = RGB(0, 255, 153)
.Add(Type:=xlCellValue, Operator:=xlGreater, Formula1:="=150").Interior.Color = RGB(160, 255, 189)
End With
End Sub