View Single Post
  #6   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

this is so bizzare. I've tried the .copy/.paste/.delete, I've tried the .cut/.insert, both attempts have the code stop executing after the destination (paste/etc) runs...

On Friday, September 23, 2016 at 9:25:22 AM UTC-7, Claus Busch wrote:
Hi,

Am Fri, 23 Sep 2016 09:13:45 -0700 (PDT) schrieb Matthew Dyer:

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


try:

Sub MoveDone()
Dim i As Long, LRow As Long

With Worksheets("CIT291")
LRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LRow To 2 Step -1
If UCase(.Cells(i, 1).Value) = "DONE" Then
.Rows(i).Copy _
Sheets("CIT291_History").Cells(Rows.Count, 1).End(xlUp)(2)
.Rows(i).Delete
End If
Next i
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016