VBA – Year Function

  • Post author:
  • Post category:VBA
  • Post comments:0 Comments
Year function

The Year function returns an integer that represents a year of the specified date.

Syntax

Year(date) 

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   msgbox(Year("2013-06-30"))
End sub

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

2013

Previous Page:-Click Here

Leave a Reply