Excel VBA Date Function
VBA Date Function
The Date function in VBA returns the current date.
Syntax
Date( )
Parameter
NA
Return
This function returns the current date.
Example 1
Sub DateFunction_Example1() ' retuning the current date in the variable currentDate Dim currentDate As Date currentDate = Date Cells(1, 1).Value = currentDate End Sub
Output
2/7/2020 0:00