Link to home
Start Free TrialLog in
Avatar of ca1358
ca1358

asked on

Excel VBA Format Date, "yy"

I have this code, I need to format P20 to read "108" not "107"
I am getting "18"


Any help would greatly be appreciated.
This First one is what I had and it gave "107" but I need to read "108"
'///////////////////////////////////////////////////////
ElseIf Range("P20") = 1 Then
    Sheets("GN15").Range("z28:z32") = " "
    Sheets("GN15").Range("z28:z32") = Range("p20") & Format(Date, "yy")
ElseIf Range("P20") = 2 Then
    Sheets("GN15").Range("z28:z32") = " "
    Sheets("GN15").Range("z28:z32") = Range("p20") & Format(Date, "yy")

'///////////////////////////////////////////////////////
So I tried
'/////////////////////////////////////////////////////////////////////
ElseIf Range("P20") = 1 Then
    Sheets("GN15").Range("z28:z32") = " "
    Sheets("GN15").Range("z28:z32") = Range("p20") & (Format(Date, "yy") + 1)
ElseIf Range("P20") = 2 Then
    Sheets("GN15").Range("z28:z32") = " "
    Sheets("GN15").Range("z28:z32") = Range("p20") & Format(Date, "yy") + 1)
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ca1358
ca1358

ASKER

Thanks for looking!!

This is the answer

Sheets("CONV10").Range("z28:z57") = Range("p20") & 0 & Format(Date, "yy") + 1