Hi All,
I am using the below code for removing all the rows contains #N/A. but its giving me error if there is no #N/A in any row.
Could you please suggest in which line I need to modify the code and how ?
Thanks for your valuable feedback.
Regards,
Rajender
I am using the below code for removing all the rows contains #N/A. but its giving me error if there is no #N/A in any row.
Could you please suggest in which line I need to modify the code and how ?
Code:
Sub Delete_NA()
Dim N As Long, rFilter As Range
Sheets("BDR_Table Utran_HWF_RETSUBUNIT").Select
Range("V3").Select
N = Cells(Rows.Count, "V").End(xlUp).Row
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set rFilter = Range("V2:V" & N)
Set rr = Range("V3:V" & N)
rFilter.AutoFilter Field:=22, Criteria1:="#N/A"
Set rkill = rr.Cells.SpecialCells(xlCellTypeVisible)
rkill.EntireRow.Delete
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
rFilter(1).AutoFilter
End Sub
Regards,
Rajender