Delete row in Excel if it contains string
In Excel you can use the allmighty Visual Basic Editor to create very useful macros. Today I will share with you a macro which deletes a row if it contains some string. The code is
Sub delgoogle()
Dim i As Long
With ActiveSheet.UsedRange
For i = .Row + .Rows.Count – 1 To .Row Step -1
If Cells(i, “A”).Text Like “*google*” Then Rows(i).Delete
Next i
End With
End Sub
What this code does, is look in the sheet where the macro is ran, for a row containing the word google. Note the “*” which means that the row can be like agoogle or googlef or even agooglea and will still delete it.

















































Leave your response!