hey,
Does anybody have an idea how to speed up this code. Its work perfectly but is really slow when I need to the move line(s).
Code is triggered when workbook is saved.
kr
Kevin
Does anybody have an idea how to speed up this code. Its work perfectly but is really slow when I need to the move line(s).
Code is triggered when workbook is saved.
kr
Kevin
VBA Code:
Sub Move()
Dim xRg, xCell As Range
Dim i, J, K As Long
i = Worksheets("New").UsedRange.Rows.Count
J = Worksheets("Archive").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Archive").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("New").Range("L3:L" & i)
On Error Resume Next
Application.ScreenUpdating = False
Application.EnableEvents = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "Done" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Archive").Range("A" & J + 1)
xRg(K).EntireRow.Delete
If CStr(xRg(K).Value) = "Done" Then
K = K - 1
End If
J = J + 1
End If
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub