Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Name of month

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Name of month

Use MMMM rather than MM in your format string.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Fabrizio" wrote in message
...
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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Name of month

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

--
Kevin Backmann


"Fabrizio" wrote:

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!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Name of month

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)

"Fabrizio" wrote in message
...
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!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Name of month

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:

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)

"Fabrizio" wrote in message
...
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!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Name of month


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)

"Fabrizio" wrote in message
...
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:

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)

"Fabrizio" wrote in message
...
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!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Name of month

month should be one month behind

Just to be different ...

[A1] = MonthName(Month(DateAdd("m", -1, Now)))

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Fabrizio" wrote in message
...
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:

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)

"Fabrizio" wrote in message
...
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!






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Name of month

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
count month when date is in day/month/year format ccKennedy Excel Worksheet Functions 6 April 30th 09 03:32 AM
excel to make the days cary over month to month automaticly GARY New Users to Excel 1 April 19th 08 06:05 PM
Excel 2003 month to month data change grid Chad[_2_] Excel Discussion (Misc queries) 2 February 15th 08 01:36 AM
copy worksheet from previous month and rename to current month Dan E. Excel Programming 4 December 8th 05 09:40 PM
transfer cell $ amount to other sheet month-to-month without overc Colin2u Excel Discussion (Misc queries) 1 July 28th 05 02:36 AM


All times are GMT +1. The time now is 08:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"