View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach[_3_] Otto Moehrbach[_3_] is offline
external usenet poster
 
Posts: 31
Default Setting up a Month Array

Dave
You have solved my problem again. Thanks.
Do you know of a source for learning how to work with arrays in VBA? I am
sorely lacking in knowledge of how to setup an array, declare an array,
access an array. I thought I would learn from your response to my question
in this thread but you didn't respond to that part of my question. What you
gave me is far better than using an array and I thank you for that, but I am
always trying to learn more. Thanks again. Otto
"Dave Peterson" wrote in message
...
how about (for xl2002):

MsgBox MonthName(myNum, True)

or befo

Option Explicit
Sub testme01()

Dim myMonth As String
Dim myNum As Long

myNum = 3

myMonth = Format(DateSerial(2003, myNum, 1), "mmm")
MsgBox myMonth

End Sub

Otto Moehrbach wrote:

Excel 2002, Win XP
I have a need to get a Text month from a number month. IOW, if I have a

3,
I want to get "Mar" without the quotes.
I think I need to set up an array something like:
Months(Array("Jan","Feb","Mar" etc))
Then Months(3) would get me "Mar".
Obviously I don't know the code to do this. If someone could help me

with
this, it would be much appreciated.

If there is an easier way to get "Mar" from 3 that would help too.

However,
I would still like to have help with setting up an array like the above
because I need the education. Arrays are new to me as you can tell.
Thanks for the help. Otto


--

Dave Peterson