I'm making small excel to reduce the amount of work at my job. I decided that because of frequent data refreshing using VB would be the best resolution to constant formatting and clearing cells. I haven't touch VB in 5 years and I don`t see why this isn't working.
The code should work I checked it as different buttons but after some copying and pasting, conditional formatting isn't working.
Set rng = Range("B1:B15")
rng.Clear
'Formating Data with color to Value
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
The code should empty cells B1 to B15 and format them to change colours based on value. Its only part of colour formatting I didn't want to put all 24 lines of code.