Do Loop

2077delta

Board Regular
Joined
Feb 17, 2002
Messages
245
I have the following Do Loop statement. Each time I attempt to run it I get an error message that says Compile Error: Loop without Do. What gives? Is this another mess of "DoDo" from MS that I have to work around?<pre>Sub Testsubtotal()

Dim Division As String
Division = "00"

Do
cell1 = ActiveCell.Offset(1, 5).Address
ActiveCell.End(xlDown).Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
cell2 = ActiveCell.Offset(-1, 5).Address
ActiveCell.Offset(0, 5).Value = "=subtotal(9," & cell1 & ".." & cell2 & ")"
ActiveCell.Offset(0, 5).Copy Range(ActiveCell.Offset(0, 6), ActiveCell.Offset(0, 7))
Range(ActiveCell.Offset(0, 5), ActiveCell.Offset(0, 7)).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinous
.Weight = xlThin
.ColorIndex = xlAutomatic
ActiveCell.End(xlToLeft).End(xlDown).Select
findcell = ActiveCell.Value
Division = Right(Left(findcell, InStr(1, findcell, " ", 1) + 2), 2)
Loop Until Division = "99"


End Sub</pre>
This message was edited by Juan Pablo G. on 2002-09-04 10:25
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

2077delta

Board Regular
Joined
Feb 17, 2002
Messages
245
Thanks. I copied the with section from another macro and just didn't look at it that closely.
 

Forum statistics

Threads
1,181,539
Messages
5,930,487
Members
436,741
Latest member
buckeyerich

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top