Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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
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
Locating a range of dates and listing somewhere else? A.S. Excel Discussion (Misc queries) 1 February 6th 07 10:43 PM
Adding months to dates should account for 28-30-31 day months Graham Excel Worksheet Functions 3 February 1st 06 12:06 PM
Convert listing of events with dates to calendar - Pls help jennifer Excel Programming 5 March 28th 05 06:33 PM
Dates to months and calculating values for their months jigsaw2 Excel Programming 1 September 5th 03 01:35 PM
Grouping and Listing Projected Projects By Inclusive Dates P Cheek Excel Programming 0 July 24th 03 11:01 PM


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

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

About Us

"It's about Microsoft Excel"