none
VBA - last two digits of current year RRS feed

  • Question

  • using some simple code to increase the value of A1 by 1 each time a button is clicked to start a new quote. the value of A1 then becomes the quote number.

    how can I add code to get last 2 digits of current year.

    assume X represents last 2 digits I would use:

    range("b10")=X &"-"& range("a1")   

    ex: 18-43

    thanks

    Doug

    Thursday, April 12, 2018 3:59 PM

Answers

  • You can use

    Range("B10") = Format(Date, "yy") & "-" & Range("A1")


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Proposed as answer by Terry Xu - MSFT Friday, April 13, 2018 2:58 AM
    • Marked as answer by 6da4 Friday, April 13, 2018 1:04 PM
    Thursday, April 12, 2018 5:35 PM

All replies