I have created a user defined function to determine whether cells are highlighted a particular color, and it works in some situations, but not the one I need; Basically it works when that cell is permanently highlighted that color but I am basing it on conditional formatting and the function doesn’t work if the cell is that color due to conditional formatting.
Public Function Active(Rng As Range) As Boolean
If Rng.Interior.Color = RGB(217, 151, 149) _
Then Active = True
End Function
Any help as to why would be much appreciated.
For simple Conditional Formatting (NONE-Color scaling type), you can refer to @brettdj and @Chuff ‘s external reference
http://www.xldynamic.com/source/xld.CFConditions.html#specific
How do I find the fill colour value of a conditionally formatted cell in Excel 2007 using vba?
For color scaling Conditional formatting, I have tried pasteSpecial but it’s not working.
The only workable solution for me is to copy the range into MS Word, and then copy the range back into EXCEL. This will remove the conditional formatting. Then you can get the background color as
Cells(X,Y).interior.colorOr else you need to implement the color scaling type of conditional formatting yourself.