The VBA NOW Function

Related Functions:
VBA Date
VBA Time

Description

The VBA Now Function returns the current date and time. The function takes no parameters and therefore, its syntax is:

Now( )

VBA Now Function Example

A simple example of the VBA Now function is shown below:

' Store the current date and time in the variable dateTime
Dim dateTime As Date
dateTime = Now()

After running the above VBA code, the variable dateTime is set to the current date and time.

(Note that in VBA, dates and times are stored as a part of the 'Date' data type).