Ask Your Question

custom function not automatic updating [closed]

asked 2013-08-12 08:43:13 +0200

salsacook gravatar image

updated 2015-08-27 13:56:16 +0200

Alex Kemp gravatar image

I try to create a custom function for checking cell background color.

Function ColorCheck()
Dim v
oActiveSheet = ThisComponent.getCurrentController().getActiveSheet()
v=oActiveSheet.getCellByPosition( 0, 0)
if vartype(v) = 9 then
  ColorCheck = v.CellBackColor
if v.CellBackColor = 2302940 then
  ColorCheck = "TRUE"
End Function

It basically works when I use "=ColorCheck()", but if I update the background of the referenced cell the value does not change until I recreate my function entry. I tried recalculating function but I does not work too.

How can I get this to auto update the value if I change the Color ?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-11-06 07:43:31.836699

1 Answer

Sort by » oldest newest most voted

answered 2013-08-12 09:55:56 +0200

JohnSUN gravatar image

updated 2013-08-12 10:19:26 +0200

Try this

=ColorCheck() + INT(RAND())

Functions such as RAND(), NOW(), TODAY() are calculated when the data changes on the sheet and it will lead to a recalculation each of formulas in which they are included. INT(RAND()) always equal zero. So, you can add this zero to result of your function

(But you will have TRUE0 for color 2302940!)

edit flag offensive delete link more


An ugly hack but works, thanks. MS Office has a proper way to do this, but sadly LO appears to lack it.

kumiponi gravatar imagekumiponi ( 2014-03-19 20:48:34 +0200 )edit

Question Tools

1 follower


Asked: 2013-08-12 08:43:13 +0200

Seen: 539 times

Last updated: Aug 12 '13