ExcelFunctions.net Logo

The VBA DAY Function

Home » Excel-VBA-Tutorial » VBA-Operators-And-Functions » VBA-Day-Function
Search this site:
Custom Search

Description

The VBA Day Function returns the day number (from 1 to 31) of a supplied date.

The syntax of the function is:

Day( date )

VBA Day Function Example

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

Const CurrDate = "29/11/2009"
Dim DayNum As Integer

DayNum = Day(CurrDate)

After running the above snippet of VBA code, the variable 'DayNum' holds the value 29, which is the day number of the date "29/11/2009" (where the date "29/11/2009" is in the format dd/mm/yyyy).





Valid XHTML 1.0 Transitional
Disclaimer Privacy Policy

Copyright © 2008-2011 ExcelFunctions.net