VBA DATE Function (Syntax + Example)

Last Updated: June 22, 2023
puneet-gogia-excel-champs

- Written by Puneet

The VBA DATE function is listed under the date category of VBA functions. When you use it in the VBA code, it returns the current date as per the system. It’s just like the TODAY function which you use in the worksheet. The Date returns have the mm/dd/yyyy format or the format which you have defined.

Syntax

Date()

Arguments

  • There’s no argument to define within the function.

Example

To practically understand how to use VBA DATE function, you need to go through the below example where we have written a vba code by using it:

example-vba-date-function
Sub example_DATE()
Range("A1").Value = Date
End Sub

In the above example, we have used the DATE function to enter the current date into cell A1.

Unlike the TODAY function, (which you can use in the worksheet) the date entered by the VBA DATE function is not volatile, so if you want to enter the current date again you need to run the code again.