| View previous topic :: View next topic |
| Author |
Message |
laiseng General User

Joined: 30 Dec 2003 Posts: 10 Location: perak
|
Posted: Mon Apr 05, 2004 11:55 am Post subject: a permenent =now() function |
|
|
is there any function that only print the current date and time like what =now() function do?
i cant use now() function coz when on the next day it will show todays date and time but not yesterday.
is there any way to insert current date and time permenently and the date will not change the next time i reopen the spreedsheets? _________________ L@iSeng
http://www.utarcf.shyper.com/
http://www.sengsquare.shyper.com/ |
|
| Back to top |
|
 |
avantman42 Super User

Joined: 28 Jul 2003 Posts: 751 Location: Staffordshire, UK
|
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Mon Apr 05, 2004 12:27 pm Post subject: |
|
|
Not through a standard function. You could provide a user function or use a macro to enter the current date into a cell. For example: This simple macro gets the current date (and time); stores the value in the currently selected cell; formats the value as a date.
| Code: | Sub Main
oDoc=stardesktop.getcurrentcomponent()
oSel=oDoc.getCurrentSelection()
oSel.value=Now() ' insert todays date & time at selection
oSel.NumberFormat=75 ' format selected cell as a date
End Sub |
Put this in an OO.o basic macro library, assign it to a keystroke, menu item ... |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Apr 05, 2004 12:37 pm Post subject: Re: a permenent =now() function |
|
|
| laiseng wrote: | is there any function that only print the current date and time like what =now() function do?
i cant use now() function coz when on the next day it will show todays date and time but not yesterday.
is there any way to insert current date and time permenently and the date will not change the next time i reopen the spreedsheets? |
Don't use the function, just type in the date; not an arduous task
David. |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8984 Location: Lexinton, Kentucky, USA
|
Posted: Mon Apr 05, 2004 3:13 pm Post subject: |
|
|
David (the dfrench one),
| Code: | | oDoc=stardesktop.getcurrentcomponent() | I needed to change this line to
in order to run this neat piece of code.
EDIT: I was running your code directly from the IDE where I got an error. I find that it works fine if I do Tools > Macros > Macro > Run. I guess this is an example of what Andrew has been talking about, i.e., when run from the IDE, oDoc gets assigned the IDE instead of the last active document.
Last edited by JohnV on Sun May 09, 2004 7:14 pm; edited 1 time in total |
|
| Back to top |
|
 |
Doug Jenkins Guest
|
Posted: Mon Apr 05, 2004 4:59 pm Post subject: A permanent =now() function |
|
|
Enter =now()
Press F9
Press enter.
BTW if you do this in Excel 2000 it displays in number format, not date. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Apr 06, 2004 6:29 pm Post subject: Re: A permanent =now() function |
|
|
[quote="Doug Jenkins"]Enter =now()
Press F9
Press enter.
/quote]
Neat!!
David. |
|
| Back to top |
|
 |
rstill Guest
|
Posted: Sat May 08, 2004 8:50 pm Post subject: user functions |
|
|
| dfrench wrote: | | <snip> You could provide a user function... <snip> |
I've been trying to figure out how to do this. Can you point me to instructions? |
|
| Back to top |
|
 |
bwolsey Guest
|
Posted: Fri Jun 25, 2004 8:35 am Post subject: Re: A permanent =now() function |
|
|
| Doug Jenkins wrote: | Enter =now()
Press F9
Press enter. |
Thanks tons for this... It's GREAT. Just what I've been looking for.
Brent |
|
| Back to top |
|
 |
|