Some disappointment:
Now I'm not so sure any more that this is possible. My idea was to check
the currently selected cell, but it has two big flaws:
1: When updating cell contents, any cell can be selected.
2: ThisComponent.CurrentSelection.getValue() seems to always return 0 in a
situation like that, no matter which cell is selected and no matter its
value… but even if that part worked, the whole thing wouldn't work anyway,
see 1.
So I simply failed to make it work. Sorry.
In my Google Spreadsheet, I have a script that fills in the corresponding
cell in column A if one of a few cells in the same row was filled, but
there doesn't seem to be any (easy) way to trigger a macro to run when a
cell was changed in LibreOffice. Maybe trying with listeners, but I never
studied those so I'm totally clueless about them.
In Google Spreadsheets you only have to create a function and call it
OnEdit(). It will run every time a cell is changed. In that function, you
just write code to find out what cell was changed and if a cell in a
certain column or cell range was changed, just fill in the current date
and/or time value in your time- or date column at the same row as the cell
that was changed. It's actually very straight forward.
Anyway, odd that I couldn't find an easy way to do it in LibreOffice Calc.
I'm sure it's possible, but I don't have a clue how to do it, at the
moment. I'm sure I'm overlooking something. This should be easy, shouldn't
it?
A few simple workarounds that comes to mind:
Use the pre-defined keyboard shortcuts to insert date, time or date and
time. I don't remember the shortcuts now, because I changed mine (to Ctrl+↵
for date), but maybe it is Ctrl+; that is the same as in Excel?
Another workaround is to use the NOW() function and when finished just
select all date cells and then hit Ctrl+c Insert ↵. Ctrl+c for copying the
cell range, Insert for Paste Special (or is that just another one of those
keyboard shortcuts that I changed on my own setup?) and ↵ for executing the
paste.
Or write a macro that replaces all date cell's formulas with their values
automatically and run it before saving your spreadsheet. Or maybe let the
same macro also save the spreadsheet and use that macro instead of Ctrl+s
for saving.
Kind regards
Johnny Rosenberg