Do Loop

2077delta

Active Member
Joined
Feb 17, 2002
Messages
252
Office Version
  1. 365
Platform
  1. Windows
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Thanks. I copied the with section from another macro and just didn't look at it that closely.
 
Upvote 0

Forum statistics

Threads
1,222,824
Messages
6,168,461
Members
452,191
Latest member
youngeagle1794

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