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 Den fre 2 okt. 2020 kl 19:58 skrev Johnny Rosenberg <gurus.knu...@gmail.com >: > Den fre 2 okt. 2020 kl 11:41 skrev Chimel <chime...@live.fr>: > >> Hi, >> >> I use the formula IF(A1<>"";NOW()) copied to every cell of column B. >> It gives me the correct time every time I type anything on a line of >> column >> A. >> But this is refreshed constantly by the time of the computer, > > > Yes, that's the point with the NOW() function. It's usually used for > calculating time, for instance how long ago a certain date was, for > instance =NOW()-A1, which you then format to whatever format you like. With > no formatting you get it in days. > > not the time I >> typed something in column A. >> > > That's correct and intended. > > I tried looking for a static version of NOW() or playing with iterations >> (probably not correctly) or looking for a way to stop recomputing this >> specific column to no avail. >> Is there a way to set on column B the time of the typing on each line of >> column A and keep it as a static time. >> > > Yes, I actually do that in a Google Spreadsheet, but it can be done in all > spreadsheets that support macros or scripts, I think. > >> >> I am usually good with formulas, but this very basic need escapes me. >> > > It's probably because there is no cell function for that. You have to > create your own. > > As far as usability is concerned, a STATICNOW() function seems much more >> useful than the current NOW() function. > > > It depends on what you want to do. See above. I find both useful, but in > different situations. > > >> Or inserting a 0,1 argument for >> staticness or something. >> So far, I am forced to type or insert the time manually each time. >> Let me repeat it: Manually each time! Me! ;) >> > > I'll experiment a bit with a macro for this. I'm back when done, if nobody > beats me to it. > > > Kind regards > > Johnny Rosenberg > > >> >> Thanks, >> Chimel. >> >> >> >> -- >> Sent from: >> http://document-foundation-mail-archive.969070.n3.nabble.com/Users-f1639498.html >> >> -- >> To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org >> Problems? >> https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ >> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette >> List archive: https://listarchives.libreoffice.org/global/users/ >> Privacy Policy: https://www.documentfoundation.org/privacy >> >> -- To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette List archive: https://listarchives.libreoffice.org/global/users/ Privacy Policy: https://www.documentfoundation.org/privacy