View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
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