I have this macro which is to filter a set of data by #N/A entries, then copy and paste them into the first available blank cell in a different worksheet.
Sub DetermineGoodTable()
'
' DetermineGoodTable Macro
'
'
ActiveSheet.Range("$A$1:$D$66").AutoFilter Field:=2, Criteria1:="#N/A"
Columns("B:B").Select
Selection.ClearContents
Dim Summary_Range As Range
Set Summary_Range = Worksheets("Sheet5").AutoFilter.Range
With Summary_Range
.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(xlVisible).Copy
End With
Sheets("Sheet2").Select
Range("D1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
The problem here is, that there won't always be data to be filtered to #N/A as as such there will be nothing to copy.
As such an error occurs saying that there is no data.
Is it possible to code the macro so that if it can't find data then it should just continue with what it was doing?
I plan for the macro to continue on after this, back in Sheet 2. So, essentially, it probably needs to understand that if there's no data then it should just dump the macro back to sheet 2 so it can continue with what it was doing?
Bookmarks