Hi guys! Need your help!
I've got a macro that :
1) Select all the rows from a table when the A value is ''Complété''
2) Copy these rows to another worksheet
3) Delete theses rows from the first table
My sub is working perfectly, execepted that if there is no value that meets the criteria (''complété''), then it deletes everything. I'm pretty sure you can see why this is a problem
How can I make the sub to abord itself if the criteria isn't met?
Here is my sub ;
I've got a macro that :
1) Select all the rows from a table when the A value is ''Complété''
2) Copy these rows to another worksheet
3) Delete theses rows from the first table
My sub is working perfectly, execepted that if there is no value that meets the criteria (''complété''), then it deletes everything. I'm pretty sure you can see why this is a problem
How can I make the sub to abord itself if the criteria isn't met?
Here is my sub ;
VBA Code:
Sub Archive()
' Copy Completed task value from WorksheetPanier to WorksheetArchives
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Sheets("Panier").Select
ActiveSheet.ListObjects("Panier").Range.AutoFilter Field:=1, Criteria1:= _
"Complété"
Range("Panier").Select
Selection.Copy
Set copySheet = Worksheets("Panier")
Set pasteSheet = Worksheets("Archives")
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
' Go back and delete Completed task
Sheets("Panier").Select
Application.CutCopyMode = False
Selection.EntireRow.Delete
ActiveSheet.ListObjects("Panier").Range.AutoFilter Field:=1
' End routine
ThisWorkbook.Save
ActiveWorkbook.RefreshAll
End Sub