MrExcel Publishing
Your One Stop for Excel Tips & Solutions

DELETING A ROW


Posted by mike k on July 17, 2000 10:03 AM

i need to delete the row if the number 2 appears... this isnt working..it has to search through many many rows..

ElseIf ActiveCell = "37" Then
ActiveCell.Formula = "SUSAN CADIGAN"
ElseIf ActiveCell = "39" Then
ActiveCell.Formula = "PREMIUM"
ElseIf ActiveCell = "25" Then
Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
End If


Posted by Ryan on July 17, 0100 10:52 AM

Mike,

Here you go, let me know how it works. Just select the top cell in the column you want to look in and run it.

Ryan


Sub Find2()

Application.ScreenUpdating = False

Do While ActiveCell.Value <> ""
Select Case ActiveCell.Value
Case "37"
ActiveCell.Value = "SUSAN CADIGAN"
ActiveCell.Offset(1, 0).Select
Case "39"
ActiveCell.Value = "PREMIUM"
ActiveCell.Offset(1, 0).Select
Case "25"
Selection.EntireRow.Delete
End Select
Loop

Application.ScreenUpdating = True

End Sub

Posted by mike k on July 17, 0100 11:02 AM

it did not work.. lines with 25 still appear. thanks for tying

mike

Posted by Ryan on July 17, 0100 11:07 AM

Mike,

Worked fine for me, how is the on the sheet. The macro stops if there is a blank line. If there are blank like let me know and I'll change it.

Ryan

Posted by mike k on July 17, 0100 11:17 AM

IT TAKES TOO LONG>> what about the way i was doing it.. can you do it like that.. with the esleif??

thanks