ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date Macro (https://www.excelbanter.com/excel-discussion-misc-queries/136351-date-macro.html)

in_trouble

Date Macro
 
How can I enter todays date with a macro, without the date updating tomorrow?

JE McGimpsey

Date Macro
 
One way:

Public Sub InsertDate()
With ActiveCell
.Value = Date
.NumberFormat = "dd mmm yyyy"
End With
End Sub

However, simply typing CTRL-; may work for you without a macro.


In article ,
in_trouble wrote:

How can I enter todays date with a macro, without the date updating tomorrow?


Stout

Date Macro
 
See if this will do it...i'm no expert though

Sub datemacro()
With ActiveCell
.FormulaR1C1 = "=TODAY()"
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub

"in_trouble" wrote:

How can I enter todays date with a macro, without the date updating tomorrow?



All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com