chadski778
Active Member
- Joined
- Mar 14, 2010
- Messages
- 297
Could i please have code for deleting a row containing specific text, for example, 'apple', in a spreadsheet.
Thanks
Thanks
[COLOR="Blue"]Sub[/COLOR] DeletingRows()
[COLOR="Blue"]Dim[/COLOR] i [COLOR="Blue"]As[/COLOR] [COLOR="Blue"]Long[/COLOR]
Application.ScreenUpdating = [COLOR="Blue"]False[/COLOR]
[COLOR="Blue"]For[/COLOR] i = Cells(Rows.Count, 1).End(xlUp).Row [COLOR="Blue"]To[/COLOR] 1 [COLOR="Blue"]Step[/COLOR] -1
Cells(i, 1).EntireRow.Delete
[COLOR="Blue"]Next[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
Sub delro()
Dim i As Long, fnd
With ActiveSheet.UsedRange
For i = .Rows.Count To 1 Step -1
Set fnd = .Rows(i).Find("apple", lookat:=xlPart)
If Not fnd Is Nothing Then .Rows(i).Delete xlUp
Next i
End With
End Sub