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.
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