how to select a range that start in diferent row

P

Pasmatos

Hi, please i need help.

I have some worksheets with formulas and the last formula in the rows
terminate with the word "END" i have a expression that find that word "END"
and select that cell. Now i need to automaticaly select and delete all rows
until row 3000 below that cell. This word are not in same rown in all
worksheets this my dificult.
Sometimes in range p200, p50, p989, etc i dont have same start range.

I appreciate yor help, please help.
 
D

Dave Peterson

I'm not quite sure I understand, but maybe this will help:

Option Explicit
Sub testme02()

Dim FoundCell As Range

With ActiveSheet
With .Range("P:p")
Set FoundCell = .Cells.Find(what:="End", _
After:=.Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
End With
End With

If FoundCell Is Nothing Then
MsgBox "Not found"
Else
FoundCell.Resize(3001).EntireRow.Delete
End If

End Sub
 
Top