Thursday 19 January 2023

Insert Current Date and Time

 The best way to insert the current date and time is to use the NOW function which takes the date and time from the system and returns it.

excel tips tricks insert current date time

The only problem with this function is it’s volatile, and whenever you recalculate something it updates its value. And if you don’t want to do this, the best way is to convert it to hard value. You can also use the below VBA code.

Sub timestamp()
Dim ts As Date
With Selection
.Value = Now
.NumberFormat = "m/d/yyyy h:mm:ss AM/PM"
End With
End Sub

Or these methods to insert a timestamp in a cell.

No comments:

Post a Comment