Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the background color from a Conditional Formatting in Excel using VBA

Tags:

People also ask

Can you use a macro for conditional formatting?

This conditional formatting can also be done in Excel VBA programming using the 'FormatConditions collection' macro/procedure. The FormatConditions represents a conditional format that one can set by calling a method that returns a variable of that type.


I would like to obtain the cell background color assigned using a conditional formatting rule in Excel in my VBA script. I realized that using Range.Interior.Color property doesn't have the color resulting of an applied conditional formatting feature from Excel.

I did some research and I found this long way here, it compiles and runs but I don't get the assigned color [I get always (255,255,255)]

I am using Excel 2016 and I am wondering if there is a simpler way to obtain this information using some built-in VBA function or using any other excel trick.