Deleting Rows between text

pcapasso

New Member
Joined
Dec 6, 2010
Messages
11
I have a long complex macro that I keep adding text to in order to improve. Right now it's perfect except for one last pet peeve item. Basically there is a report that we dump to excel and the macro formats the report, however sometimes the report is more than one page and there are two headers. I want to remove one header, but keep the other. Obviously the header is between different text depending on where the page break lands. I was able to write code to find certain things and delete the rows, however that deletes the page 1 header as well which I want to keep. These are financial statements and the header text is this:
Report ID: DC_COMPINC
Format ID: VARSUM
Reforecast Bud: MFC09
Style ID: @

However there are a bunch of blank rows as well. I'm not sure if this can be done, and certainly manually deleting the text is not a big deal I am just trying to automate as much as possible. From what I can tell there are a total of 10 rows that need to be deleted, the first 4 are the text above, plus 6 blank rows below that.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

pcapasso

New Member
Joined
Dec 6, 2010
Messages
11
So I've been thinking about how to do it. Basically I need to find the second instance of "*Report ID*" and select that row and the following 9 rows as well, and then delete them. Not sure how to do that.
 

Forum statistics

Threads
1,136,314
Messages
5,675,032
Members
419,544
Latest member
MVPDoug

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top