Vba delete entire row if contains certain text in Excel

VBA Delete Entire Row if Contains Certain Text
I've searched on here, but every code I put in gives me an error back. Data in column D, If any of the cells contains "Record Only" I need it to delete the entire row.


lastRow = Cells(Rows.Count, "D").End(xlUp).Row
For i = lastRow To 1 Step -1
        If (Cells(i, "D").Value) = "Record Only" Then
               Cells(i, "A").EntireRow.Delete
        End If
Next i

(for formulas, depending on your country, you might have to change ; with , or the opposite

 Other excel answers



You can find similar Excel Questions and Answer hereunder

1) How can I save a WorkSheet as a new WorkBook using VBA?

2) How can I dynamically add series to an existing chart using VBA?

3) How do I add a shape using VBA?

4) Excel 2010 vba replacement of application filesearch in Excel

5) How to freeze a row or column in Excel

6) How can I get users to select a folder to save the output of my macro?

7) Converting numbers stored as text to numbers via macro in Excel

8) Write to text file without quotes in vba in Excel

9) How do I enter a formula in a cell using VBA (using Relative Reference)?

10) How can I get the count of number of series in a Chart using VBA?


Here the previous and next chapter