Hi
use this modified code
Sub MoveCompletedData()
Dim lr1 As Long, lr2 As Long
Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = Sheets("All Data")
Set ws2 = Sheets("Done")
If WorksheetFunction.CountIf(ws1.Range("C:C"), "Completed") = 0 Then
MsgBox "No Complteded entries to move"
Exit Sub
Else
Application.ScreenUpdating = False
lr1 = ws1.Cells(Rows.Count, 1).End(xlUp).Row
lr2 = ws2.Cells(Rows.Count, 1).End(xlUp).Row + 1
ws1.Range("$A$1:$E$1").AutoFilter Field:=3, Criteria1:="Completed"
ws1.Range("A2:E" & lr1).SpecialCells(xlCellTypeVisible).Copy ws2.Range("A" & lr2)
Application.CutCopyMode = False
Range("A2:E" & lr1).SpecialCells(xlCellTypeVisible).ClearContents
ws1.Range("$A$1:$E$1").AutoFilter Field:=3
ws1.AutoFilter.Sort.SortFields.Clear
ws1.AutoFilter.Sort.SortFields.Add Key:=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending
With ws1.AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.Apply
End With
ws1.Range("A2").Select
End If
ws1.Range("A1:E1").AutoFilter
Application.ScreenUpdating = True
End Sub
Bookmarks