Mike
Mike

Reputation: 1938

Copy the month name, not number into a variable vba

I am trying to get the name of the month to compare if it is the current month. What is in the cell I'm looking at is usually something like this:

=Today()

or

10/24/2013

I've tried copy and paste to get the names instead of the numbers, but it doesn't do it. I'm sure there is a way to get the month name from the value in the cell, I just don't know what it is.

Upvotes: 2

Views: 362

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

If you have

=TODAY()

in a cell (say G19), format that cell as "mmmm"

Then in VBA:

Sub Getmonth()
    MsgBox Range("G19").Text
End Sub

Upvotes: 1

Related Questions