Name of month

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am making a macro that generates a report. I want to set the title of the
report to the current month. I dont quite know how to use the now property
(my help fuunction does not work). Code:

strDate1 = Format(Now, "YYYY-MM-DD")

with this I get the month (and day etc.) but I want to get the month and be
able to show it in a cell. How do you do this? Is it possible to the month in
another language? (my excel is in swedish and I wantb to get in swedish).
Please help me!
 
Use MMMM rather than MM in your format string.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
This will give you the month as a word, using whatever international settings
windows is using:

Dim strDate As String
strDate = Format(Date, "yyyy-mmmm-dd")
ActiveSheet.Range("A1").Value = strDate
 
strDate1 = Format(Date,"mmmm")
Range("A1").Value = strDate

I don't know if you will need to change the mmm for Swedish (it would be
tttt for Tag in German)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
great! i just remembered that we do the report one month after so that the
month should be one month behind (if it is june then the text should be may).
Is there any way to do this?

"Bob Phillips" skrev:
 
Dim strDate1
strDate1 = Format(Date - Day(Date), "mmmm")
Range("A1").Value = strDate1
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
month should be one month behind

Just to be different ...

[A1] = MonthName(Month(DateAdd("m", -1, Now)))
 
Ahh. I just noticed the language was Swedish as I hit the Send button.
I'd be curious to learn if MonthName returns the correct name in a language
other than English.
--
Dana DeLouis
[A1] = MonthName(Month(DateAdd("m", -1, Now)))
<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top