Hello, I have some conditional formatting to apply across numerous rows in my worksheet and I would like to speed up that process as much as possible by using VBA. Ideally I will select some cells and then the VBA would run through each row and apply the Red (High) - Green (low) cell colour formatting, dependant on the column values. My code when I recorded it is below but I don't know how to scale this if, for example, I have selected cells P18:S200 and then I want it to run through each row.
Thanks in advance.
Code:
Sub Macro4()
Range("P18:S18").Select
Selection.FormatConditions.AddColorScale ColorScaleType:=3
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).ColorScaleCriteria(1).Type = _
xlConditionValueLowestValue
With Selection.FormatConditions(1).ColorScaleCriteria(1).FormatColor
.Color = 8109667
.TintAndShade = 0
End With
Selection.FormatConditions(1).ColorScaleCriteria(2).Type = _
xlConditionValuePercentile
Selection.FormatConditions(1).ColorScaleCriteria(2).Value = 50
With Selection.FormatConditions(1).ColorScaleCriteria(2).FormatColor
.Color = 8711167
.TintAndShade = 0
End With
Selection.FormatConditions(1).ColorScaleCriteria(3).Type = _
xlConditionValueHighestValue
With Selection.FormatConditions(1).ColorScaleCriteria(3).FormatColor
.Color = 7039480
.TintAndShade = 0
End With
End Sub
Thanks in advance.