Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates in Excel

Status
Not open for further replies.

daltek

Programmer
Nov 13, 2001
3
0
0
US
Is there a way to insert today's date using a macro, but have the date not update when the day changes? Like a date stamp that doesn't update.
 
daltek,
You don't need a macro, unless you want one.
The keyboard shortcut to insert the current date as text is [ctrl]; (semi-colon).

If you want a macro - I record typing in the formula
=today()
copy it
paste special, value
stop macro results in:

ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

There maybe "cleaner" code to do the same thing.
Hope this helps.
AngO
 
You might want to trigger the macro when the cell you want the date in is selected.....Hope this helps you
 
Thanks. Worked great. Paste Special was the key.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top