Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Formatting Cells whose value between 10 and 20

Sub FormatBetween10And20()     With Selection         .FormatConditions.Delete         .FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _             Formula1:="=10", Formula2:="=20"         .FormatConditions(1).Interior.Color = RGB(255, 0, 0)     End With End Sub 'Format cells whose value less than 15 Sub FormatLessThan15()     With Selection         .FormatConditions.Delete         .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _             Formula1:="=15"         .FormatConditions(1).Interior.Color = RGB(255, 0, 0)     End With End Sub