Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default del certain rows based on word search

Hello,
I import about 50 pages of data from another program that leaves page
headers which consist of 10 rows of junk. In between these rows of headers,
there is aprox. 10 to 12 rows of good data, not always the same number of
rows. I would like to end up with just the data and delete the junk rows. The
one common identifier (for search purposes) I see is the company name in
column E of the top of the header (the 1st row of junk). How would I go about
automatically searching out and deleting the row that includes the company
name, as well as the 9 tows beneath it?. This header exists about 50 times,
so I need something that can search through and delete all of the headers.

thanks in advance for any help,
Robert
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default del certain rows based on word search

Sub DeleteRows()
FindString = "company name" 'adjust to company name
Set b = Range("E:E").Find(what:=FindString, lookat:=xlWhole)
While Not (b Is Nothing)
b.Resize(10).EntireRow.delete
Set b = Range("E:E").Find(what:=FindString, lookat:=xlWhole)
Wend
End Sub


Gord Dibben MS Excel MVP

On Tue, 16 Jun 2009 13:30:02 -0700, Robert
wrote:

Hello,
I import about 50 pages of data from another program that leaves page
headers which consist of 10 rows of junk. In between these rows of headers,
there is aprox. 10 to 12 rows of good data, not always the same number of
rows. I would like to end up with just the data and delete the junk rows. The
one common identifier (for search purposes) I see is the company name in
column E of the top of the header (the 1st row of junk). How would I go about
automatically searching out and deleting the row that includes the company
name, as well as the 9 tows beneath it?. This header exists about 50 times,
so I need something that can search through and delete all of the headers.

thanks in advance for any help,
Robert


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 193
Default del certain rows based on word search

Sweet! This works great. Thanks Gord!
Robert

"Gord Dibben" wrote:

Sub DeleteRows()
FindString = "company name" 'adjust to company name
Set b = Range("E:E").Find(what:=FindString, lookat:=xlWhole)
While Not (b Is Nothing)
b.Resize(10).EntireRow.delete
Set b = Range("E:E").Find(what:=FindString, lookat:=xlWhole)
Wend
End Sub


Gord Dibben MS Excel MVP

On Tue, 16 Jun 2009 13:30:02 -0700, Robert
wrote:

Hello,
I import about 50 pages of data from another program that leaves page
headers which consist of 10 rows of junk. In between these rows of headers,
there is aprox. 10 to 12 rows of good data, not always the same number of
rows. I would like to end up with just the data and delete the junk rows. The
one common identifier (for search purposes) I see is the company name in
column E of the top of the header (the 1st row of junk). How would I go about
automatically searching out and deleting the row that includes the company
name, as well as the 9 tows beneath it?. This header exists about 50 times,
so I need something that can search through and delete all of the headers.

thanks in advance for any help,
Robert



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
Search for rows in one sheet and copy into another sheet based on customer id [email protected] Excel Worksheet Functions 1 October 22nd 07 03:09 AM
word search Pivotrend Excel Discussion (Misc queries) 1 April 17th 06 02:59 PM
Search Word guy Excel Worksheet Functions 6 January 7th 06 03:38 PM
1 word search brandi New Users to Excel 3 December 5th 05 09:11 AM
need formula to search column for a word and return another word Skyline Excel Discussion (Misc queries) 5 November 18th 05 10:00 PM


All times are GMT +1. The time now is 09:19 PM.

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

About Us

"It's about Microsoft Excel"