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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel sheet row removal

Status
Not open for further replies.

tonyvee1973

IS-IT--Management
Oct 22, 2009
156
GB
Hi
Trying to remove entire rows in excel2010 if row E contains 11111.
Tried the script below as asks for the number but doesnt seem to ork.
Any ideas as to why this would be?
Thanks


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

Set SrchRng = ActiveSheet.Range("E1", ActiveSheet.Range("E45511").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 the AutoFilter

Set the column E filter to 11111

Select all VISIBLE ROWS OF DATA

Right-Click - DELETE

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
So simple, thanks Skip.
Been working with different Macro's on the 50000+ line sheet for days now and think i've been brainwashed with them - Forgot to keep things simple.
Appreciate the help
 


Oh I did forget to mention...

Clear the AutoFilter

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