Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listing months between two dates
Hi,
I have a start and an end date. I need to create a list of months between two dates. For example, if I have a start date (A13) of April 1st, 2008 and an end date (A14) of October 31st, 2008, I need a list starting in B19 with the first month being "April", the second being "May" in B20, etc. to the seventh being "October" in B25. I need some code to parse the months between any two dates. Thanks in advance, Kent Lysell -- Kent Lysell Financial Consultant Ottawa, Ontario W: 613.948-9557 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listing months between two dates
Put the code below in the module for the worksheet.
It's only for the start and end months being in the same calendar year. It should be pretty easy to modify to cross calendar years. No error trapping either. Hth, Merjet Private Sub Worksheet_Change(ByVal Target As Range) Dim iMo As Integer If Target.Address = "$A$13" Or Target.Address = "$A$14" Then Range("B19:B30").Clear Do Cells(19 + iMo, 2) = MonthName(iMo + Month(Range("A13"))) iMo = iMo + 1 Loop Until Month(Range("A13")) + iMo - 1 = Month(Range("A14")) End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Locating a range of dates and listing somewhere else? | Excel Discussion (Misc queries) | |||
Adding months to dates should account for 28-30-31 day months | Excel Worksheet Functions | |||
Convert listing of events with dates to calendar - Pls help | Excel Programming | |||
Dates to months and calculating values for their months | Excel Programming | |||
Grouping and Listing Projected Projects By Inclusive Dates | Excel Programming |