Greetings all.
I recorded a macro that showed me how to highlight a range of cells if a certain condition was met (duplication for example).
This works fine but now i am trying to (via VBA) test to see if that cell's color is red, blue, green, etc and if so do something with it but i am having no luck as i am not sure how to test to see if cell has been formatted to a color via a format conditions?Selection.FormatConditions.AddUniqueValues Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority Selection.FormatConditions(1).DupeUnique = xlDuplicate With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = vbRed .TintAndShade = 0 End With
i have tried using
but i am starting to realize for some reason, the cell itself is not really the color red? anyone able to help me out?If ActiveCell.FormatConditions = vbRed Then ' this returns the value -4142 ' do something here end if