wolf.stalker
09-23-2010, 03:00 PM
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).
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriori ty
Selection.FormatConditions(1).DupeUnique = xlDuplicate
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = vbRed
.TintAndShade = 0
End With
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?
i have tried using
If ActiveCell.FormatConditions = vbRed Then
' this returns the value -4142
' do something here
end if
but i am starting to realize for some reason, the cell itself is not really the color red? anyone able to help me out?
I recorded a macro that showed me how to highlight a range of cells if a certain condition was met (duplication for example).
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriori ty
Selection.FormatConditions(1).DupeUnique = xlDuplicate
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = vbRed
.TintAndShade = 0
End With
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?
i have tried using
If ActiveCell.FormatConditions = vbRed Then
' this returns the value -4142
' do something here
end if
but i am starting to realize for some reason, the cell itself is not really the color red? anyone able to help me out?