Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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


  #2   Report Post  
Posted to microsoft.public.excel.misc
TedMi
 
Posts: n/a
Default Deleting rows in a macro in Excel

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
TedMi
 
Posts: n/a
Default Deleting rows in a macro in Excel

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


"TedMi" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default Deleting rows in a macro in Excel

?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.

--
David
  #5   Report Post  
Posted to microsoft.public.excel.misc
Scott Wagner
 
Posts: n/a
Default Deleting rows in a macro in Excel

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

"THEFALLGUY" wrote:

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




Reply
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 07:15 AM.

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"