[Solved] Keystroke to enter the current date

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Stickerjim
Posts: 1
Joined: Thu Jul 16, 2020 8:10 pm

[Solved] Keystroke to enter the current date

Post by Stickerjim »

 Edit: Split from [Solved] Need help with creating date macro 
My first attempt at anything this "complicated". All I was looking for was a simple keystroke (like Ctrl + Shift + ;) to enter the current date. I have "=DATE(NOW())" in the cell (minus the quotations) but have no idea what to do with it to produce an actual date, and all it gives is an Err:511 for a value. Any help would be appreciated.

Thanks
Last edited by MrProgrammer on Thu Jul 23, 2020 5:02 pm, edited 3 times in total.
Reason: New request in solved topic requires new topic; Tagged ✓ [Solved]
OpenOffice 4.1.7 on Win 8.1
User avatar
MrProgrammer
Moderator
Posts: 4906
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Keystroke to enter the current date

Post by MrProgrammer »

Hi, and welcome to the forum.
Stickerjim wrote:All I was looking for was a simple keystroke (like Ctrl + Shift + ;) to enter the current date.
Do you want a dynamic date, which changes when you reopen the spreadsheet on a different date? If so, use cell formula =TODAY(). No macro is needed.

Or do you want a static date, which remains forever the same after you enter it? If so, record a macro. You only need to do this once. You don't need to know any programming. Then you can call the macro with a simple keystroke. Read about DateStamp in [Tutorial] Favorite Recorded Calc Macros. The macro puts a =TODAY() formula in the cell and then alters the cell so the value can't change. Read the "keyboard shortcut" link there to learn about assigning Ctrl+Shift+; to your macro. Or you can put a button on a toolbar to call your Macro.
Stickerjim wrote:I have "=DATE(NOW())" in the cell … all it gives is an Err:511
Your formula is bogus. The syntax for DATE is DATE(year;month;day) like DATE(2020;7;16). DATE needs three parameters and you supplied one, hence Err:511 Missing variable - Function requires more variables than are provided. =NOW() would have inserted a date/time, which you could format as a date, but it will be dynamic.

Concept 3. Dates in cells Ten concepts that every Calc user should know.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Keystroke to enter the current date

Post by Zizi64 »

All I was looking for was a simple keystroke (like Ctrl + Shift + ;) to enter the current date.
The LibreOffice has such feature ("insert fixed values" like the today date).
Try it.


Or you must create your own macro for this task in Apache OpenOffice.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply