View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Matthew Dyer Matthew Dyer is offline
external usenet poster
 
Posts: 178
Default loop ends unexpectedly before finishing loop

On Thursday, September 22, 2016 at 6:22:24 PM UTC-7, isabelle wrote:
oops sorry, please corrected "CIT291" with "CIT291_History"

isabelle


made adjustments so the cut/paste operates properly, but still the code ENDS after the insert command and I CANNOT FIGURE OUT WHY

Sub MoveDone()
Dim i As Long, ii As Long, Start As Long
ii = LastRow(Worksheets("CIT291_History"))
With Worksheets("CIT291")
Start = LastRow(Sheets(.Name))
For i = Start To 2 Step -1
If UCase(.Range("A" & i).Value) = "DONE" Then
.Rows(i).Cut
Worksheets("cit291_history").Rows(ii + 1).Insert , Shift:=xlDown
ii = ii + 1
End If
Next i
End With
End Sub