Recieve a "Cells Not Found" error on the If Statement. I would like, if when filtered data finds nothing, to do nothing. Instead, when the range is empty I get an error on the If statement
Suggestions appreciated.
Thank you.
Suggestions appreciated.
Thank you.
Code:
If Range(Cells(headerRow, 1), Cells(lastRow, lastCol )).SpecialCells(xlCellTypeVisible) Is Nothing Then
msgbox(" no data to copy") 'Do nothing
Else
Range(Cells(headerRow , 1), Cells(lastRow, lastCol )).SpecialCells(xlCellTypeVisible).Copy
Windows(newBook).Activate
Range("A" & headerRow ).Select: ActiveSheet.Paste: Range("A" & headerRow).Select
Application.CutCopyMode = False
End If