Option Explicit
Sub GenerateDates()
Dim Days() As Date
Dim DaysInMonth As Long, i As Long
Dim Year As Long, Month As Long
Dim arrDays As Variant
Year = InputBox("please enter year")
Month = InputBox("Please enter month number")
DaysInMonth = DateSerial(Year, Month + 1, 1) - _
DateSerial(Year, Month, 1)
Range("a1").Offset(i, 0) = i
ReDim Days(1 To DaysInMonth)
For i = 1 To DaysInMonth
Days(i) = DateSerial(Year, Month, i)
Range("a1").Offset(1, 0) = i
MsgBox i
Next
End Sub
Moderator's Note: Welcome to the forum, Codes should be enclosed with code tags. Select the code then hit the "#" sign. I'll do it for now. Thank you for joining the community.
Bookmarks