This is bugging me. I’m using LibreOffice Calc dynamically set the background color of a cell to the Hex value in that cell, but the kludge solution I have works on the wrong sheet;
function BGCOLOR(col, row, red, green, blue)
	Dim Doc As Object
	Dim Sheet As Object
	Dim Cell As Object   
	
	Doc = ThisComponent
	Sheet = Doc.getSheets().getByName("From_DakkaDakka")
rem	Sheet = Doc.getSheets().getByIndex(3)
rem	Sheet = ThisComponent.getCurrentController().getActiveSheet()
	
	Cell = Sheet.getCellByPosition(col - 1, row - 1)
	Cell.CellBackColor = RGB(red, green, blue)
	BGCOLOR=Cell.CellBackColor
end function
Then in the cell I have;
=BGCOLOR(CELL("COL",J2),CELL("ROW",J2),HEX2DEC(LEFT(J2,2)),HEX2DEC(MID(J2,3,2)),HEX2DEC(RIGHT(J2,2)))
But this is an ugly solution. Does anyone know a better way?
