Hi All -
I am using the script below to look at column A and if N/A is present it will delete that entire row of data. I'm using this script on a data set that has roughly 400-500k rows and when I run it, the script just deletes everything. When the script is used on smaller data sets ~ a dozen or so it works fine. Could you let me know how to fix this?
Code
Option Explicit
Sub GetRid()
Range("A1", Range("A" & Rows.Count).End(xlUp)).AutoFilter 1, "#N/A"
Range("A2", Range("A" & Rows.Count).End(xlUp)).EntireRow.Delete
[a1].AutoFilter
End Sub
Sub GetRid2()
Dim lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
Range("A1", Range("A" & Rows.Count).End(xlUp)).AutoFilter 1, "#N/A"
lr = Range("A" & Rows.Count).End(xlUp).Row
If lr > 1 Then Range("A2", Range("A" & Rows.Count).End(xlUp)).EntireRow.Delete
[a1].AutoFilter
End Sub
Display More