ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   referencing months (https://www.excelbanter.com/excel-programming/334099-referencing-months.html)

Daniel[_4_]

referencing months
 
Hello,
I need to create a list of month wich would equal their string expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel



Dave Peterson

referencing months
 
newFileStr = "Projection " & format(date,"mmmm") & "-March " & _
Left(Sheets(1).Name, 9)

is one way.

Daniel wrote:

Hello,
I need to create a list of month wich would equal their string expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel


--

Dave Peterson

Harald Staff

referencing months
 
Hi Daniel

Number to month ? Try this:

Sub test()
Dim L As Long
L = Application.InputBox("ENter month (1 to 12):", Type:=1)
Select Case L
Case 1 To 12
MsgBox StrConv(Format(DateSerial(1990, L, 1), "mmmm"), _
vbProperCase)
Case Else
End Select
End Sub

HTH. Best wishes Harald

"Daniel" skrev i melding
...
Hello,
I need to create a list of month wich would equal their string expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel





STEVE BELL

referencing months
 
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel





Tom Ogilvy

referencing months
 
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.


--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string

expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel







STEVE BELL

referencing months
 
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.


--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string

expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel









Tom Ogilvy

referencing months
 
But I did say it worked in 2000...

Yes you did and that could be expanded to xl2000 or later. I added that is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.


--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string

expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July for
example.

Someone has an idea how to do this?

Thanks

Daniel











STEVE BELL

referencing months
 
The OP should know as much as possible.

The problem is with me - I suffer constant "Senior Moments"... and don't
remember the
differences between 2000 and other versions. I just hope that by showing it
worked in 2000 might alert the OP to double check the version being used...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But I did say it worked in 2000...


Yes you did and that could be expanded to xl2000 or later. I added that
is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string
expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July
for
example.

Someone has an idea how to do this?

Thanks

Daniel













Daniel[_4_]

referencing months
 
Thanks to all.

What is the OP?

__________
"STEVE BELL" wrote in message
news:F%gAe.23466$ZN6.6632@trnddc02...
The OP should know as much as possible.

The problem is with me - I suffer constant "Senior Moments"... and don't
remember the
differences between 2000 and other versions. I just hope that by showing
it worked in 2000 might alert the OP to double check the version being
used...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But I did say it worked in 2000...


Yes you did and that could be expanded to xl2000 or later. I added that
is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string
expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July
for
example.

Someone has an idea how to do this?

Thanks

Daniel















Tom Ogilvy

referencing months
 
Original Poster - you.
"Daniel" wrote in message
.. .
Thanks to all.

What is the OP?

__________
"STEVE BELL" wrote in message
news:F%gAe.23466$ZN6.6632@trnddc02...
The OP should know as much as possible.

The problem is with me - I suffer constant "Senior Moments"... and don't
remember the
differences between 2000 and other versions. I just hope that by

showing
it worked in 2000 might alert the OP to double check the version being
used...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But I did say it worked in 2000...

Yes you did and that could be expanded to xl2000 or later. I added

that
is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string
expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July
for
example.

Someone has an idea how to do this?

Thanks

Daniel

















Dana DeLouis[_3_]

referencing months
 
Hi. Just to mention...
Another option to your nice idea of...
?Left(MonthName(7), 3)
Jul

Would be to set the second option to True
?MonthName(7,True)
Jul

:)
--
Dana DeLouis
Win XP & Office 2003


"STEVE BELL" wrote in message
news:F%gAe.23466$ZN6.6632@trnddc02...
The OP should know as much as possible.

The problem is with me - I suffer constant "Senior Moments"... and don't
remember the
differences between 2000 and other versions. I just hope that by showing
it worked in 2000 might alert the OP to double check the version being
used...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But I did say it worked in 2000...


Yes you did and that could be expanded to xl2000 or later. I added that
is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string
expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July
for
example.

Someone has an idea how to do this?

Thanks

Daniel















STEVE BELL

referencing months
 
Dana,

Thanks!!!

Your method is a lot cleaner...

That teaches me to look at the Help definitions more closely...
I missed the second argument definition...

--
steveB

Remove "AYN" from email to respond
"Dana DeLouis" wrote in message
...
Hi. Just to mention...
Another option to your nice idea of...
?Left(MonthName(7), 3)
Jul

Would be to set the second option to True
?MonthName(7,True)
Jul

:)
--
Dana DeLouis
Win XP & Office 2003


"STEVE BELL" wrote in message
news:F%gAe.23466$ZN6.6632@trnddc02...
The OP should know as much as possible.

The problem is with me - I suffer constant "Senior Moments"... and don't
remember the
differences between 2000 and other versions. I just hope that by showing
it worked in 2000 might alert the OP to double check the version being
used...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But I did say it worked in 2000...

Yes you did and that could be expanded to xl2000 or later. I added that
is
does not work in xl97 and I should have said "And Earlier"

Unless you prefer the OP not be aware of that.
--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:_SgAe.23363$ZN6.7788@trnddc02...
Thanks Tom.

Got confused - he did refer to: "( 01 = Jan, 02 = Feb, ...., 12=Dec )"
showing mmm, yet in his example he did show mmmm

But I did say it worked in 2000...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
But wouldn't work in Excel 97 - just for information.

for the question as stated,

mon = MonthName(x)

would be better

currentMonthStr would equal July for
example.

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:TAfAe.1305$Gk4.934@trnddc01...
And then there is (worked in Excel 2000):

Dim mon As String, x As Integer
For x = 1 To 12
mon = Left(MonthName(x), 3)
MsgBox mon
Next


--
steveB

Remove "AYN" from email to respond
"Daniel" wrote in message
...
Hello,
I need to create a list of month wich would equal their string
expression
( 01 = Jan, 02 = Feb, ...., 12=Dec )

Then I would have something like :
newFileStr = "Projection " & currentMonthStr & "-March " &
Left(Sheets(1).Name, 9), so that currentMonthStr would equal July
for
example.

Someone has an idea how to do this?

Thanks

Daniel


















All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com