LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
THEFALLGUY
 
Posts: n/a
Default Deleting rows in a macro in Excel

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Rows in MS Excel MacK Excel Discussion (Misc queries) 9 July 30th 07 06:24 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Can Excel "slide up" rows with content thru empty rows to condense portly44 Excel Worksheet Functions 2 April 1st 05 12:47 AM
Insert rows Mr. G. Excel Worksheet Functions 3 March 31st 05 03:49 AM
inset rows and copy formatting , excel macro sloanranger Excel Discussion (Misc queries) 13 March 9th 05 11:44 PM


All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"