Hi,
I have what I think is a simple problem, but can't figure it out:
Basically, some of my sheets may have a filtered selection included, some may not, but if the selection is not found the code seems to loop forever. How do I prevent this?
Here is my code:
Basically, if criteria1 does not find "REC" I want the code to stop and proceed to the next piece in my code rather than loop forever and try to paste something that it can't find.
How do I add that piece in?
Thanks!
I have what I think is a simple problem, but can't figure it out:
Basically, some of my sheets may have a filtered selection included, some may not, but if the selection is not found the code seems to loop forever. How do I prevent this?
Here is my code:
Code:
Worksheets("Services Export").Range("A1").AutoFilter _
Field:=21, Criteria1:="=REC"
Sheets("Services Export").Select
Range("A1").Select
ActiveSheet.Range(Selection, Cells(Selection.End(xlDown).Row, Selection.End(xlToRight).Column)).Select
Selection.Copy
Sheets("Services Export (REC)").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Basically, if criteria1 does not find "REC" I want the code to stop and proceed to the next piece in my code rather than loop forever and try to paste something that it can't find.
How do I add that piece in?
Thanks!