Time Stamp

D

DAI

Hello,

I have created a macro to give me start and finish times with the click of a
button,

Function my_now()
Application.Volatile (False)
my_now = Now
End Function

However every now and the all entries are recalculated. (It only happens when
im not looking)

I was under the impression that with the (Application.Volatile (False)) this
could not happen.

Any ideas would be welcome.
 
N

Niek Otten

Just leave the line with Application.Volatile out

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Hello,
|
| I have created a macro to give me start and finish times with the click of a
| button,
|
| Function my_now()
| Application.Volatile (False)
| my_now = Now
| End Function
|
| However every now and the all entries are recalculated. (It only happens when
| im not looking)
|
| I was under the impression that with the (Application.Volatile (False)) this
| could not happen.
|
| Any ideas would be welcome.
|
 
D

DAI

Niek,

If I did that excel would recalculate the function every time i open the
sheet. Which defeats the purpose of time stamping.


Niek said:
Just leave the line with Application.Volatile out

| Hello,
|
[quoted text clipped - 13 lines]
|
| Any ideas would be welcome.
 
D

Don Guillett

use a regular sub to click on
sub datestamp()
activecell=date
'or
'range("a2")=date
end sub
 
D

DAI

Don,

I have limited kowledge of VBA, how woulld I use the instructions you have
given. If you could give a step by step that would be great.


Thank You

Don said:
use a regular sub to click on
sub datestamp()
activecell=date
'or
'range("a2")=date
end sub
[quoted text clipped - 16 lines]
Any ideas would be welcome.
 
G

Gord Dibben

If you are clicking a button use a macro to insert a static time and not a
Function which can/will change.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub


Gord Dibben MS Excel MVP
 
D

DAI via OfficeKB.com

Gord,

That works well althogh I have canged the format of the date and time.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "dd/mm/yyyy hh:mm")
End Sub

Thank You


Gord said:
If you are clicking a button use a macro to insert a static time and not a
Function which can/will change.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

Gord Dibben MS Excel MVP
[quoted text clipped - 13 lines]
Any ideas would be welcome.
 
D

DAI via OfficeKB.com

Gord,

That works well although I have canged the format of the date and time.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "dd/mm/yyyy hh:mm")
End Sub

Thank You


Gord said:
If you are clicking a button use a macro to insert a static time and not a
Function which can/will change.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

Gord Dibben MS Excel MVP
[quoted text clipped - 13 lines]
Any ideas would be welcome.
 
G

Gord Dibben

Thanks for the feedback.

Alternate non-vba method to enter static date/time in a cell

CTRL + ;..let go of CTRL, hit spacebar then CTRL + SHIFT + ;

Format to suit.


Gord

Gord,

That works well althogh I have canged the format of the date and time.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "dd/mm/yyyy hh:mm")
End Sub

Thank You


Gord said:
If you are clicking a button use a macro to insert a static time and not a
Function which can/will change.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

Gord Dibben MS Excel MVP
[quoted text clipped - 13 lines]
Any ideas would be welcome.

Gord Dibben MS Excel MVP
 
Top