Below code is part of a larger code where some data is filtered by using AutoFilter. And in most instances there is data in the filtered cells. However, in some instances there is no data, and when trying to use copy, I get the error "No Cells". Which makes sense.
Therefore I'm trying to use below code to exit the sub, if the filtered cells has no data in them. But the "No Cells" error keeps popping up in the first line of the code.
I've tested the range and it's populated correctly.
.Cells.Count and just
.Count. Nothing works.
Can someone help me?
If .Range("C5:C" & lastrow).SpecialCells(xlCellTypeVisible).Cells.Count = 0 Then .AutoFilterMode = False Exit Sub End If