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.mh8dociw.tw | http://m.mh8dociw.tw | http://wap.mh8dociw.tw | http://3g.mh8dociw.tw | http://4g.mh8dociw.tw | http://5g.mh8dociw.tw | http://mobile.mh8dociw.tw | http://vip.mh8dociw.tw | http://ios.mh8dociw.tw | http://anzhuo.mh8dociw.tw | http://3f9.mh8dociw.tw | http://f.mh8dociw.tw | http://eff.mh8dociw.tw | http://6bdc6.mh8dociw.tw | http://6.mh8dociw.tw | http://5066.mh8dociw.tw | 重生之投资之王