Bug 52602 - Excel Visual Basic compatibility issue in LibreOffice Calc: NumberFormat to date/time
Summary: Excel Visual Basic compatibility issue in LibreOffice Calc: NumberFormat to d...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
Reported: 2012-07-27 19:51 UTC by Tor24_1975314
Modified: 2019-07-30 03:16 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Excel test file with macro (38.00 KB, application/vnd.ms-excel)
2012-07-27 19:51 UTC, Tor24_1975314

Note You need to log in before you can comment on or make changes to this bug.
Description Tor24_1975314 2012-07-27 19:51:40 UTC
Created attachment 64804 [details]
Excel test file with macro

Excel Visual Basic Date/time formatting does not work, Excel macro code examples:

Example macro:

Sub Test_NumberFormat_DateTime()
    ' Preparing Test:
    Range("A3").FormulaR1C1 = "40969.6388888889"
    Range("B3").FormulaR1C1 = "40969.6388888889"
    Range("C3").FormulaR1C1 = "40969.6388888889"
    Range("D3").FormulaR1C1 = "40969.6388888889"
    Range("E3").FormulaR1C1 = "40969.6388888889"
    Range("F3").FormulaR1C1 = "40969.6388888889"

    ' Testing Excel VBA Code in Libre Office:
    Range("A3").NumberFormat = "hh:mm"
    Range("B3").NumberFormat = "mm/dd/yyyy hh:mm"
    Range("C3").NumberFormat = "mm/dd/yyyy hh:mm:ss"
    Range("D3").NumberFormat = "d/m/yy h:mm"
    Range("E3").NumberFormat = "d/ mmmm yyyy"
    Range("F3").NumberFormat = "d/ mmm yyyy"
End Sub

The same problem with the NumberFormat function on Windows systems with other regional settings.
Example Windows "Regional and Language Options": "German (Germany)" 
with Formula/List Separator ';' and Decimal Symbol ','

Sub Test_NumberFormat_Number()
    Range("A3").NumberFormat = "0,00000000"
    Range("B3").NumberFormat = "0.00000000"
    Range("C3").NumberFormat = "#,##0.00000"
End Sub
Comment 1 Tor24_1975314 2012-09-02 11:45:16 UTC
This bug occurs in LibreOffice version 3.5.6 and 3.6.1
Comment 2 Julien Nabet 2014-02-09 15:53:49 UTC
Tor: do you reproduce this with a newer LO version (4.1.4 or
Comment 3 Tor24_1975314 2014-02-18 18:36:51 UTC
Yes, I reproduced this bug also in newer versions of LibreOffice for Windows! 

Tested with LibreOffice versions:, and
Comment 4 Tor24_1975314 2014-05-04 14:47:04 UTC
This bug was reproduced also in LibreOffice Calc version and rc!
Comment 5 QA Administrators 2015-06-08 14:42:52 UTC Comment hidden (obsolete)
Comment 6 Tor24_1975314 2015-06-15 21:36:08 UTC
The problem still exists!

This bug was also reproduced in LibreOffice!
Comment 7 Tor24_1975314 2016-06-26 14:37:49 UTC
This problem still exists and was also reproduced in LibreOffice versions,, and for Windows.

(Test system: Windows 7 64-bit, Intel Core2Duo P8700 2.53 Ghz, 4 GB RAM, Java SE Runtime Environment build 1.6.0_24-b07)
Comment 8 Xisco Faulí 2017-06-12 11:53:20 UTC
Changing version back to the earliest affected version.
Comment 9 Tor24_1975314 2017-11-05 20:43:22 UTC
Bug also reproduced with the newest version of LibreOffice 5.4.2 for Windows.
Comment 10 QA Administrators 2019-07-30 03:16:46 UTC
Dear Tor24_1975314,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team