Page 1 of 1

[Solved] RGB Function odd results

PostPosted: Sat Oct 12, 2019 12:07 pm
by BratcheGeige
The RGB(R, B, G) function should be very simple just returning R * 256 * 256 + G *256 + B. But on three of my documents (originally excel files but now saved as .ods) RGB(R, G, B) returns a reversed result as if I had written RGB(B, G, R). Can anyone explain this odd behaviour? I tried redefining it myself in my My Macros & Dialogs Library hoping my new definition would be referenced. No luck. Can someone tell me how to force the use of my new definition?

Re: RGB Function odd results

PostPosted: Sat Oct 12, 2019 1:17 pm
by Zizi64
Can you upload your sample file here?

Re: RGB Function odd results

PostPosted: Sat Oct 12, 2019 2:03 pm
by BratcheGeige
I have cut out most of my data (over 2000 lines) and cut out all my buttons and code and just left the RGB test. It still doesn't work. See the attachment.

Re: RGB Function odd results

PostPosted: Sat Oct 12, 2019 2:31 pm
by musikai
Option VBASupport 1

seems to corrupt it

Re: RGB Function odd results

PostPosted: Sat Oct 12, 2019 2:48 pm
by Zizi64
My LibreOffice 6.1.6 gives me different result too...

Re: RGB Function odd results

PostPosted: Sat Oct 12, 2019 7:56 pm
by musikai
BratcheGeige wrote:Can someone tell me how to force the use of my new definition?


Give it another name

Re: RGB Function odd results

PostPosted: Tue Oct 15, 2019 12:08 pm
by BratcheGeige
Thank you musikai!
When I erased
Option VBASupport 1
RGB() works correctly.