1. The VBA YEAR Function

      Related Functions:
      VBA Day
      VBA Month

      Description

      The VBA Year Function returns the four digit year from a supplied date.

      The syntax of the function is:

      Year( Date )

      VBA Year Function Example

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

      ' Extract the year from the date "11/29/2015"
      Const currDate = "11/29/2015"
      Dim yearNum As Integer
      yearNum = Year(currDate)
      ' The variable yearNum is now equal to 2015.

      After running the above VBA code, the variable yearNum holds the value 2015.


      VBA Year Function Error

      If the Year function is supplied with a value that cannot be interpreted as a valid date, it will return the error:

      Run-time error '13': Type mismatch

      VBA Run Time Error 13 Message Box

      1. http://www.ryc4h3rj.tw | http://m.ryc4h3rj.tw | http://wap.ryc4h3rj.tw | http://3g.ryc4h3rj.tw | http://4g.ryc4h3rj.tw | http://5g.ryc4h3rj.tw | http://mobile.ryc4h3rj.tw | http://vip.ryc4h3rj.tw | http://ios.ryc4h3rj.tw | http://anzhuo.ryc4h3rj.tw | http://5.ryc4h3rj.tw | http://91.ryc4h3rj.tw | http://4.ryc4h3rj.tw | http://33cd7b.ryc4h3rj.tw | http://8a4.ryc4h3rj.tw | http://fe138.ryc4h3rj.tw | 日本香港澳门大片免费看