help w/ find me

  • Thread starter Thread starter ksnapp
  • Start date Start date
K

ksnapp

Hello,

Is there a way I can make this code look for more than the firs
occurance?



Sub DelRows() ' deletes

Dim LastRow As Long
Dim nextname As Long
Dim RngDel As Range

Application.ScreenUpdating = False

With ActiveSheet
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Set rng = .Range(Cells(1, "A"), Cells(LastRow, "A"))
End With

findme = "CHICKEN"

With rng
Set found = .Find(what:=findme, LookIn:=xlValues)
If Not found Is Nothing Then
nextname = found.End(xlDown).Row
Set RngDel = ActiveSheet.Range(found, Cells(nextname - 1, "A"))
RngDel.EntireRow.Delete
End If
End With

Application.ScreenUpdating = True

End Sub

so far I have been copying running the full sub a few times. But I'
like to wrap all my subs in to one big sub. Or that's the drea
atleas
 
look at the example code in help for the FindNext command. This will show
you how to do this.
 
Back
Top