Is there a way to get the background color of a cell that has Conditional Formatting - Color Scale applied to it, using VBA? I’ve tried but it’s not working properly, and it seems that Conditional Formatting does not actually set the background color in the normal way.
I have a range of values, and I set up a very basic stoplight conditional formatting rule: Min is Red, 0 is Yellow, and Max is Green. That works properly. I then created a function in VBA that should pull the background color from a cell and return the decimal value. Instead, it only returns -1, which is the result for No Fill cells. I also checked the background transparency, and it returns 1, meaning the cell is transparent. My VBA code is based on Cell.CellBackColor but maybe there’s another option I’m missing.
My ultimate goal was to use the output of my custom function for a color range in a Chart.
Attaching a simple example
conditional.ods (33.5 KB)
System: Win11
LibreOffice Calc 7.4.2.3 (x64)