Olivia
Olivia

Reputation: 177

Writing Macro using VBA in Excel

I have already used this code: year() to get the current year. But, I only want the last two digits of the year. Foe example, from today's date 01/19/2017, I only want to pull up and display a message box containing '17'. How can I write this code in Macro using VBA in Excel?

Upvotes: 4

Views: 286

Answers (1)

Fadi
Fadi

Reputation: 3322

Try this:

MsgBox Format(Date, "yy")

Upvotes: 5

Related Questions