troubleshooting Question

Excel VBA Format Date, "yy"

Avatar of ca1358
ca1358 asked on
Visual Basic Classic
2 Comments1 Solution3007 ViewsLast Modified:
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
EDDYKT

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros