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://73878c.mh8dociw.tw | http://ef5c5.mh8dociw.tw | http://35375.mh8dociw.tw | http://7fb3.mh8dociw.tw | http://38be0.mh8dociw.tw | http://157e.mh8dociw.tw | 亚洲 国产 女同另类