![]() |
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 |
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 |
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 . |
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 . |
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 |
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 |
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 . |
All times are GMT +1. The time now is 01:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com