Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sgl sgl is offline
external usenet poster
 
Posts: 80
Default Do Until Loop

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
tanhks/sgl



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Do Until Loop

Taking a course?

Sub DateIncrementSample()
Dim i As Integer
Dim rtnDate As Date
Dim stDate As Date

stDate = #1/1/2000#
rtnDate = stDate

i = 1
Do Until i 100

rtnDate = DateAdd("d", 1, rtnDate)

Range("A" & i).Value = rtnDate

i = i + 1

Loop

End Sub

'After DateAdd("

'yyyy = Year
'q = Quarter
'm = Month
'y = Day of year
'd = Day
'w = Weekday
'ww = Week
'h = Hour
'n = Minute
's = Second

--
Steve

"sgl" wrote in message
...
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
tanhks/sgl



  #3   Report Post  
Posted to microsoft.public.excel.programming
sgl sgl is offline
external usenet poster
 
Posts: 80
Default Do Until Loop

Thank you for assistance that worked for me

"AltaEgo" wrote:

Taking a course?

Sub DateIncrementSample()
Dim i As Integer
Dim rtnDate As Date
Dim stDate As Date

stDate = #1/1/2000#
rtnDate = stDate

i = 1
Do Until i 100

rtnDate = DateAdd("d", 1, rtnDate)

Range("A" & i).Value = rtnDate

i = i + 1

Loop

End Sub

'After DateAdd("

'yyyy = Year
'q = Quarter
'm = Month
'y = Day of year
'd = Day
'w = Weekday
'ww = Week
'h = Hour
'n = Minute
's = Second

--
Steve

"sgl" wrote in message
...
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
tanhks/sgl




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 05:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"