I've built a macro that takes a downloaded spreadsheet and filters the infomation based on set criteria and then copies it to a specified tab. One of the criterias though, doesn't always appear. My macro gives an error when it gets to this line when the criteria is missing. How can I make it "overlook" the autofilter if the criteria isn't there? Below is my code. So in this example, if "IO" doesn't exist how can I make it skip these lines of code?
ActiveSheet.Range("$A$1:$Z$600").AutoFilter Field:=12, Criteria1:="IO"
ActiveSheet.Cells.Select
Selection.Copy
Sheets("io").Select
ActiveSheet.Paste
ActiveSheet.Range("$A$1:$Z$600").AutoFilter Field:=12, Criteria1:="IO"
ActiveSheet.Cells.Select
Selection.Copy
Sheets("io").Select
ActiveSheet.Paste