Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete entire row if cell contains - Excel 2010 1

Status
Not open for further replies.

tonyvee1973

IS-IT--Management
Oct 22, 2009
156
GB
Hi All

Looking for some help on a simple one i hope :)
I have an excel spreadsheet and want to delete the entire row if a cell in column E contains the text 222300

Any help would be appreciated
 
got the code below but this seems to delete the row if a cell in column D is blank then move the rest up. i cant think on how to convert to get the row to delete if a cell in column D = 222300
Help! :)

Sub delete_row()
Dim i As Integer, n As Integer
n = Selection.Rows.Count
For i = 1 To n
Range("D:D").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Selection.Delete Shift:=xlUp
Next i
End Sub
 
its ok, worked it out.
I use the code below and i can insert the required value and column - it seems to work!

Sub DeleteRows()
Dim c As Range
Dim SrchRng As Range
Dim SrchStr As String

Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A65536").End(xlUp))
SrchStr = InputBox("Please Enter A Search String")
Do
Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing

End Sub
 



Hi,

Turn on your AutoFilter

Assign the column D filter as 222300

Select all the VISIBLE DATA ROWS and Right-Click - DELETE



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top