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
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