this is my first time to write here ,,, um so glad for that ,
now i have excel file i try to put a start date and end date , and type the dates between this dates in range ... while lest say example
i try to use this code
Sub datetest()
Dim x, y, z, v, a, b As Range
Set x = Cells.Range("k2")
Set y = Cells.Range("l2")
Set z = Cells.Range("m2")
Set v = Cells.Range("n2")
Set a = Cells.Range("o2")
Set b = Cells.Range("p2")
Dim startDate As Date
Dim endDate As Date
startDate = DateSerial(x, y, z)
endDate = DateSerial(v, a, b)
Dim i As Integer
i = 1
While startDate <= endDate
Cells(i, 1) = startDate
startDate = startDate + 31
i = i + 1
Wend
End Sub
when i run the code , it type the dates good .
my problem is now i add 31 day ,, and the dates not come out right ,
i need to edit the code to add month per time , not a day like
start date 1-3-2020
end date 1-3-2021
the result come out date format ddd - mmm - yyyy
1-3-2020
1-4-2020
1-5-2020
1-6-2020
1-7-2020
and go on till to get to
1-3-2021
again thanks alot for ur time