Hi all,
I have seen similar posts to this, but cannot figure out how it can relate to my situation. I have an autofilter that copies data from one sheet to another. However, when no autofilter results are listed, I would like it to skip the copying steps and go on to the next autofilter criteria.
Code below:
Basically, if the Special Cells (xlCellTyperVisible).Select finds no records, I want it to skip past the pastespecial and go to the rest of my code.
Thanks in advance!
I have seen similar posts to this, but cannot figure out how it can relate to my situation. I have an autofilter that copies data from one sheet to another. However, when no autofilter results are listed, I would like it to skip the copying steps and go on to the next autofilter criteria.
Code below:
Code:
Range("A1").AutoFilter
ActiveSheet.Range("$A$1:$J$" & lRow).AutoFilter Field:=11, Criteria1:="=Athletics*", _
Operator:=xlAnd
Range("C1").Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Range("C2:J" & lRow).Select
Selection.SpecialCells(xlCellTypeVisible).Select '<---- Error occurs here saying "no data to copy or something like that"
Selection.Copy
Sheets("Athletics").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Basically, if the Special Cells (xlCellTyperVisible).Select finds no records, I want it to skip past the pastespecial and go to the rest of my code.
Thanks in advance!