1.

Write down a code in VBA for excel to display current date and Time?

Answer»

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.


Excel Now()
(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



Discussion

No Comment Found