Hello,
I found the attached VBA for generating dates but can't get it to work. Below is what I am trying to achieve:
I would like to enter a start date and end date on the first sheet of the attached. I have created names for start date and end date and in the attached file. On the second sheet I would like the start date to populate in A1 and then the next month to populate in B1, the month after to populate in C1, etc. all the way to the end date (which is defined on the first sheet).
Could someone help me with the VBA? Sheet is attached and VBA below:
Sub GenerateDatesH()
Dim FirstDate As Date
Dim LastDate As Date
Dim NextDate As Date
Dim DateOffset As Range
Dim DateIter As Date
FirstDate = Range("startdate").Value
LastDate = Range("enddate").Value
Set DateOffset = Range("C1")
For DateIter = FirstDate To LastDate
DateOffset.Value = DateIter
Set DateOffset = DateOffset.Offset(0, 1)
Next DateIter
End Sub
Thank you!
Bookmarks