| Write down a code in VBA for excel to display current date and Time?
There are two ways to display date and time in excel. Both of these are given below:-
(1)By using =NOW() function in excel cell where you need to enter current date.
(2)Second is by using below VBA code in excel
Sub timeStampNow()
Dim ts As Date
With Selection
.Value = Now
.NumberFormat = "m/d/yyyy h:mm:ss AM/PM"
End With
End Sub
Here we need to call timeStampNow() where we need that on cell in excelsheet | | |