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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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.
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,786
Members
448,992
Latest member
prabhuk279

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
Back
Top