VBA – DateSerial Function

  • Post author:
  • Post category:VBA
  • Post comments:0 Comments
Serial Function

A Function, which returns a date for the specified day, month, and year parameters.

Syntax

DateSerial(year,month,day)

Parameter Description

  • Year − A required parameter. A number between 100 and 9999 or a numeric expression. Values between 0 and 99 are interpreted as the years 1900 to 1999. For all other year arguments, use a complete four-digit year.
  • Month − A required parameter. It can also be in the form of an expression, which should range from 1 to 12.
  • Day − A required parameter. It can also be in the form of an expression, which should range from 1 to 31.

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   msgbox(DateSerial(2013,5,10))
End Sub

When you execute the above function, it produces the following output.

10/05/2014

Previous Page:-Click Here

Leave a Reply