Hi,
Im trying to create a VBA code that would loop through Column B to check if:
If cells in column B have either "Printer" or "N/A" to delete the entire row. There are about 10,000 rows in column B of which 5833 rows at random have either "Printer" or "N/A". Here's the code I currently have but I keep getting an error "Run time error '13' Type mismatch" when ran.
Please help. Thank you!
Im trying to create a VBA code that would loop through Column B to check if:
If cells in column B have either "Printer" or "N/A" to delete the entire row. There are about 10,000 rows in column B of which 5833 rows at random have either "Printer" or "N/A". Here's the code I currently have but I keep getting an error "Run time error '13' Type mismatch" when ran.
VBA Code:
Sub Clean_Data()
Dim WB As Workbook
Dim WSR As Worksheet
Dim I As Long
Dim Rng As Range, Cell As Range
Set WB = ActiveWorkbook
Set WSR = WB.Worksheets("Equip")
Set Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
For Each Cell In Rng
If Cell = "Printer" or Cell = "N/A" Then
Cell.EntireRow.Delete
End If
Next Cell
End Sub
Please help. Thank you!