LO Calc Macro change cell background color issue.

Hi all,

I have a really simple macro that I want to change the background color of a cell with. I will eventually have a column of cells with a hex value of a color, then in the next column the cells will have this macro to change the background color. I have it really simple right now to test it, but all it does is change the cell text to invisible and doesn’t change the background color at all. I’ve searched the internet and found you are supposed to use CellBackColor. This is the test macro:

Function BGCOLOR(colorhex As String)
	ThisComponent.CurrentSelection.CellBackColor = clng("&H" & colorhex)
End Function

and this is how I am calling it:

=BGCOLOR("4d4d4d")

Is there a mistake in this that I just cannot see?

Thanks,
Jon

what do expect - this color is close to black with hexvalue 000000