Deleting rows in a macro in Excel

T

THEFALLGUY

I have to delete a series of rows within several spreadsheets. I am trying
to write code for a macro that will search for wordage within a cell (Edit ->
Search), and once the search engine finds that cell, I will delete all rows
directly above that cell (not including the first two rows).

The issue I am having is that the wordage that is the result of the search
is not always in the same row; i.e. sometimes it is in row 43, sometimes 44,
etc. Is there a way within a macro to declare that I want all rows deleted
above a specified row, not including the first two rows? This is the code I
have thus far:

Cells.Find(What:="EQUIPMENT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
Rows("44:44").Select
Range(Selection, Selection.End(xlUp)).Select
Rows("4:44").Select
Range("A44").Activate
Selection.Delete Shift:=xlUp

Thank you,
THEFALLGUY
 
T

TedMi

You might want to post this in a newsgroup that deals with Excel, instead of
this one which deals withe Access Database application.
 
T

TedMi

My abject apologies! I thought I was in an Access newsgroup when I posted
this. Of course this is the correct newsgroup.
 
D

David

=?Utf-8?B?VGVkTWk=?= wrote
You might want to post this in a newsgroup that deals with Excel,
instead of this one which deals withe Access Database application.

Huh??? This IS an Excel newsgroup.
 
S

Scott Wagner

Fall Guy,

Did you find out how to solve this problem? I need to do the same thing.
Can you share your solution with me please?

Thanks,

Scott
 
Top