macro to delete rows with certain text part 1 & copy and fill down part 1

billnerd

New Member
Joined
Jan 10, 2012
Messages
17
Hi All,

Part 1

I have a delimited file which is carrying 16,000 lines of data, only 7000 are relevant. I recorded a macro to clean it up but have since realised its cell referenced and I need it to delete rows which contain certain text.

In column B I have several different rows that repeat starting with for example 'year', 'date','days'. Is there a macro which could search through column b detect cells with certain text and delete the rows.

Part 2

After deleting the rows I then have to insert a new row column A with different departments in reference to sub headings in colum B. The code on column B for example is "05021 Banking" which repeats every x amount of lines and I will manually type Banking into column A and drag down until a see a new code for example'00222 Corporate'.


Department
Banking01133 Banking
Banking780115151
Banking
Banking
Banking**Tota
Banking
Banking
Corporate05021 Corporate
Corporate78075512
Corporate
Corporate
Corporate78115219
Corporate
Corporate
Corporate2222222
Corporate

<tbody>
</tbody><colgroup><col><col></colgroup>

Is there a macro or formula which could run down column A check numerical code first 5 digits, insert text description and fill down until finds the new code and keep repeating task until hits row 16,500. The codes do repeat and other info is also contained column B which can be ignored. At the moment I just manually input the descriptions and drag down which only takes 5-10mins but I assume there must be a better way.

Thanks

John
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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