roxnoxsox
12-08-2015, 08:54 AM
I've seen a couple of similar threads but I'm struggling to follow how the problem was fixed..
I'm trying to set up a macro which will autofilter my data based on column B and delete any which say: #N/A
However, sometimes my data doesn't contain: #N/A at all and I'm GUESSING this is where it's getting stuck? See as below:
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("B2:B" & LastRow).AutoFilter Field:=2, Criteria1:="#N/A"
With ActiveSheet.AutoFilter.Range
.Offset(1).Resize(.Rows.Count - 1).EntireRow.Delete
End With
ActiveSheet.AutoFilterMode = False
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Thanks in advance and sorry for being a doofus
I'm trying to set up a macro which will autofilter my data based on column B and delete any which say: #N/A
However, sometimes my data doesn't contain: #N/A at all and I'm GUESSING this is where it's getting stuck? See as below:
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("B2:B" & LastRow).AutoFilter Field:=2, Criteria1:="#N/A"
With ActiveSheet.AutoFilter.Range
.Offset(1).Resize(.Rows.Count - 1).EntireRow.Delete
End With
ActiveSheet.AutoFilterMode = False
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Thanks in advance and sorry for being a doofus