Thread: Efficient Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Efficient Code

It looks okay. Is there a problem with it?

--
HTH

Bob Phillips

"GregR" wrote in message
oups.com...
I have this code:

Sub CopyOverCompleted()
Dim a As Long
Dim i As Long
With Sheets("Status")
i = .Cells(Rows.Count, "B").End(xlUp).Row
For a = 4 To i
If .Cells(a, "L").Value < "" Then .Cells(a,
"L").EntireRow.Cut _
Sheets("Completed").Cells(Rows.Count,
1).End(xlUp).Offset(1, 0)
Next a
End With

LastRow = Sheets("Status").UsedRange.Row - 1 + _
Sheets("Status").UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 4 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
Next r
Application.ScreenUpdating = True

End Sub

which cuts and deletes completed projects (rows) to the completed
sheet. Is there a way to shorten and improve the code. TIA

Greg