Hi,
Im looking for vba code that will create a list in column b that includes all the quarter end dates including and between two cells, A1 and A2.
Many Thanks.
Hi,
Im looking for vba code that will create a list in column b that includes all the quarter end dates including and between two cells, A1 and A2.
Many Thanks.
To answer my own question, Would welcome ideas on way to make this faster/cleaner
Sub GenerateDates() Dim FirstDate As Date Dim LastDate As Date Dim NextDate As Date FirstDate = Range("A1").Value LastDate = Range("a2").Value NextDate = FirstDate Range("B1").Select Do Until NextDate >= LastDate ActiveCell.Value = NextDate ActiveCell.Offset(1, 0).Select If Month(NextDate) = 3 Then NextDate = DateAdd("q", 1, NextDate) Else If Month(NextDate) = 12 Then NextDate = DateAdd("q", 1, NextDate) Else If Month(NextDate) = 6 Then NextDate = DateAdd("q", 1, NextDate) Else If Month(NextDate) = 9 Then NextDate = DateAdd("q", 1, NextDate) NextDate = DateAdd("d", 1, NextDate) End If End If End If End If Loop End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks