I would like to obtain the background color of a cell in an Excel sheet using a UDF formula or VBA. I found this UDF:
Public Function BColor(r As Range) As Long
BColor = r(1).Interior.ColorIndex
End Function
It can be used like this in a cell: =BColor(A1)
I'm not familiar with VBA, this returns some long value and I wonder if it is possible to obtain the hex value directly. Thank you!