help w/ find me

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
 
T

Tom Ogilvy

look at the example code in help for the FindNext command. This will show
you how to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top