Handle “No cells were found” error when filtered range is empty

Dim rngStart As Range
Dim rngFiltered As Range

'...
'...
Set rngFiltered = Nothing '<<< reset rngFiltered if running this code in a loop...
On Error Resume Next
Set rngFiltered = rngStart.SpecialCells(xlCellTypeVisible)
On Error Goto 0

If not rngFiltered is Nothing then
    rngFiltered.Copy
End If
'...
'...

Leave a Comment