Do Until Loop
Edit the dtStart to suit your requirement. For more about first argument
passed to DATEADD() functionality please refer below
Sub WriteDates()
Dim lngRow As Long
Dim dtStart As Date
Dim dtTemp As Date
dtStart = "04/28/2009"
dtTemp = dtStart
lngRow = 1
Range("A" & lngRow) = dtTemp
Do
lngRow = lngRow + 1
dtTemp = DateAdd("m", 1, dtTemp)
Range("A" & lngRow) = dtTemp
Loop Until lngRow = 100
End Sub
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
--
If this post helps click Yes
---------------
Jacob Skaria
"sgl" wrote:
I have the following
1 - A Start Date
2 - This Date must be incremented by a certain period (months, quarters,
semi-annualy etc) each time the Loop passes
3 - Need to write the result into a range
4 - "Max range" to write this in is 100 rows (calculated bewteen two ranges
- say A1:A100). loop must stop at 100.
Can someone help write this simple code for me
thanks/sgl
|