Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default automatically gets month in an array

hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober or
OCt and the remaining 11 months be filled automatically...

is it feasible?

thanks a lot

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default automatically gets month in an array

Do you also mean that if the first value is, say, feb, then your array would
start with FEb, and be filled in with the next 11 months in calendar order?

wrote in message
...
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober or
OCt and the remaining 11 months be filled automatically...

is it feasible?

thanks a lot



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default automatically gets month in an array

yes thats exactly what i wanted..not sure if its
feasible...

-----Original Message-----
Do you also mean that if the first value is, say, feb,

then your array would
start with FEb, and be filled in with the next 11 months

in calendar order?

wrote in message
...
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober

or
OCt and the remaining 11 months be filled

automatically...

is it feasible?

thanks a lot



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default automatically gets month in an array

Sub Tester1AAA()
Dim mths(1 To 12) as String
j = 2
For i = 1 To 12
mths(i) = Format(DateSerial(Year(Date), j, 1), "mmmm")
j = j + 1
Next
For i = 1 To 12
Debug.Print mths(i)
Next
End Sub

Excel will "roll" the month back to January after you reach December and
give you the correct result regardless of the start month.

--
Regards,
Tom Ogilvy


wrote in message
...
yes thats exactly what i wanted..not sure if its
feasible...

-----Original Message-----
Do you also mean that if the first value is, say, feb,

then your array would
start with FEb, and be filled in with the next 11 months

in calendar order?

wrote in message
...
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober

or
OCt and the remaining 11 months be filled

automatically...

is it feasible?

thanks a lot



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default automatically gets month in an array

Anything's possible :)

Function setMonths(FirstMonth As Byte) As String()
Dim MthNames(11) As String, i As Byte
For i = 0 To 11
MthNames(i) = Choose((FirstMonth + i - 1) Mod 12 + 1, _
"Jan", "Feb", "Mar", "Apr", "May", "Jun", _
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
Next i
setMonths = MthNames
End Function
Sub testIt2()
Dim MthNames() As String, FirstMonth As Byte
FirstMonth = 6
MthNames = setMonths(FirstMonth)
End Sub

The above needs VB6.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober or
OCt and the remaining 11 months be filled automatically...

is it feasible?

thanks a lot




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default automatically gets month in an array

Don't know how you want it set up, but would any ideas here help? Later
versions of Excel make this faster.

Sub Demo()
Dim Months(1 To 12) As String
Dim Start As Long
Dim Mth As Long

Start = 10 'October

For Mth = 1 To 12
Months(Mth) = MonthName(((Mth + Start - 2) Mod 12) + 1)
Next Mth
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


wrote in message
...
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober or
OCt and the remaining 11 months be filled automatically...

is it feasible?

thanks a lot



  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default automatically gets month in an array

thanks all for the possiblities..:-)
-----Original Message-----
hi...

I want to run a loop such that if the starting value is
oct then my array arrMonth() should start with OCtober or
OCt and the remaining 11 months be filled automatically...

is it feasible?

thanks a lot

.

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
Automatically update month Smilingmom Excel Discussion (Misc queries) 2 March 15th 10 09:36 PM
How to automatically update a 12 month budget epu Excel Discussion (Misc queries) 5 September 2nd 08 10:11 PM
First day and Last day of the month to display automatically mrbalaje Excel Discussion (Misc queries) 1 April 11th 07 02:36 PM
how do I automatically sequence the month Rubber 4 u Excel Worksheet Functions 4 February 6th 07 05:38 PM
Setting up a Month Array Otto Moehrbach[_3_] Excel Programming 5 July 12th 03 09:17 PM


All times are GMT +1. The time now is 09:20 PM.

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

About Us

"It's about Microsoft Excel"