Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jer jer is offline
external usenet poster
 
Posts: 25
Default nested loops

Some help please
when I try to run the following code I am getting "Loop without Do"

Dim cell As Range, odate As Date, ndate As Date
Set cell = ActiveWorkbook.Worksheets("Working Sample (3)").Cells(3, 2)

Do Until IsEmpty(cell.Value)

Do While cell = cell.Offset(-1, 0)
odate = cell.Offset(-1, 11).Value
ndate = cell.Offset(0, 11).Value
ndate = odate
If cell.Offset(0, 9) = "Y" Then
ndate = DateAdd("y", 1, odate)
If cell.Offset(0, 9) = "Q" Then
ndate = DateAdd("m", 3, odate)
End If
Set cell = cell.Offset(1, 0)
Loop
Set cell = cell.Offset(1, 0)
Loop
I am attempting to schedul payments based on frequency, Y = Annually and Q =
quarterly. Using the first payment date for a name in column 2, I am
attempting to schedule payment dates by frequency

col 2 col 11 col 13
1 $120.00 Y 9/30/2006
1 $100.00 Y 9/30/2006
1 $200.00 Y 9/30/2006
1 $300.00 Y 9/30/2006
1 $150.00 Y 9/30/2006

--
thanks as always for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default nested loops

You have 2 if-statements, and only one End If.
Bob Umlas

"jer" wrote in message
...
Some help please
when I try to run the following code I am getting "Loop without Do"

Dim cell As Range, odate As Date, ndate As Date
Set cell = ActiveWorkbook.Worksheets("Working Sample (3)").Cells(3, 2)

Do Until IsEmpty(cell.Value)

Do While cell = cell.Offset(-1, 0)
odate = cell.Offset(-1, 11).Value
ndate = cell.Offset(0, 11).Value
ndate = odate
If cell.Offset(0, 9) = "Y" Then
ndate = DateAdd("y", 1, odate)
If cell.Offset(0, 9) = "Q" Then
ndate = DateAdd("m", 3, odate)
End If
Set cell = cell.Offset(1, 0)
Loop
Set cell = cell.Offset(1, 0)
Loop
I am attempting to schedul payments based on frequency, Y = Annually and Q
=
quarterly. Using the first payment date for a name in column 2, I am
attempting to schedule payment dates by frequency

col 2 col 11 col 13
1 $120.00 Y 9/30/2006
1 $100.00 Y 9/30/2006
1 $200.00 Y 9/30/2006
1 $300.00 Y 9/30/2006
1 $150.00 Y 9/30/2006

--
thanks as always for the help



  #3   Report Post  
Posted to microsoft.public.excel.programming
jer jer is offline
external usenet poster
 
Posts: 25
Default nested loops

Thanks Bob ... found out after I posted ...
--
thanks as always for the help


"Bob Umlas" wrote:

You have 2 if-statements, and only one End If.
Bob Umlas

"jer" wrote in message
...
Some help please
when I try to run the following code I am getting "Loop without Do"

Dim cell As Range, odate As Date, ndate As Date
Set cell = ActiveWorkbook.Worksheets("Working Sample (3)").Cells(3, 2)

Do Until IsEmpty(cell.Value)

Do While cell = cell.Offset(-1, 0)
odate = cell.Offset(-1, 11).Value
ndate = cell.Offset(0, 11).Value
ndate = odate
If cell.Offset(0, 9) = "Y" Then
ndate = DateAdd("y", 1, odate)
If cell.Offset(0, 9) = "Q" Then
ndate = DateAdd("m", 3, odate)
End If
Set cell = cell.Offset(1, 0)
Loop
Set cell = cell.Offset(1, 0)
Loop
I am attempting to schedul payments based on frequency, Y = Annually and Q
=
quarterly. Using the first payment date for a name in column 2, I am
attempting to schedule payment dates by frequency

col 2 col 11 col 13
1 $120.00 Y 9/30/2006
1 $100.00 Y 9/30/2006
1 $200.00 Y 9/30/2006
1 $300.00 Y 9/30/2006
1 $150.00 Y 9/30/2006

--
thanks as always for the help




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
Help with nested for loops [email protected] Excel Discussion (Misc queries) 5 May 2nd 07 05:30 PM
Help with nested for loops [email protected] Excel Worksheet Functions 5 May 2nd 07 05:30 PM
nested for loops and end for SandyR Excel Programming 3 October 6th 05 09:36 PM
Help on nested loops Jan Lukszo Excel Programming 1 July 29th 04 08:41 AM
Nested loops?? CG Rosén Excel Programming 1 June 22nd 04 08:07 PM


All times are GMT +1. The time now is 12:03 PM.

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"