View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default Need help please for deleting rows that does not meet several crit

You don't provide too much information so with the assumption the values you
are looking for are in column A try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cell As Range, rng As Range, i As Long
Set rng = Columns("A").SpecialCells(xlConstants, xlTextValues)
For i = rng.Count To 1 Step -1
If rng(i).Value = "ADT7461" _
Or rng(i).Value = "REF19" _
Or rng(i).Value = "AD623" _
Or rng(i).Value = "AD8200" _
Or rng(i).Value = "ADXL330" _
Or rng(i).Value = "OP291" _
Or rng(i).Value = "AD1555" _
Or rng(i).Value = "AD5561" _
Or rng(i).Value = "COLD" Then
rng(i).EntireRow.Delete
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Mike

"Alib" wrote:


Hi All,

Can someone please help me if a macro function in excel can help delete
rows that does not meet several conditions.

Example:

For a range the macro will delete the row if it does not contain the
following characters

*ADT7461*
*REF19*
*AD623*
*AD8200*
*ADXL330*
*OP291*
*AD1555*
*AD5561*
*COLD*

the number of rows is up to 20,000 and if possible i can just assign
the conditions in a range in another worksheet so that if an additional
condition is placed it will automatically be included.

I need the help of your excel guru gods please....

this is already beyond my excel know-how


--
Alib
------------------------------------------------------------------------
Alib's Profile: http://www.officehelp.in/member.php?userid=6619
View this thread: http://www.officehelp.in/showthread.php?t=1367706

Posted from - http://www.officehelp.in