Duplicate heading rows problem

Imrkhp

New Member
Joined
Oct 22, 2017
Messages
3
I have merged 50 excel files in one file. Problem is that, there are 50 heading rows in my new created file. How I delete all heading rows except first.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Assuming the headers can be based on the first 6 columns in row1.
Try this:-
Code:
[COLOR=navy]Sub[/COLOR] MG22Oct41
[COLOR=navy]Dim[/COLOR] Lst [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] Txt [COLOR=navy]As[/COLOR] [COLOR=navy]String,[/COLOR] n [COLOR=navy]As[/COLOR] [COLOR=navy]Long[/COLOR]
Lst = Range("A" & Rows.Count).End(xlUp).Row
Txt = Join(Application.Transpose(Application.Transpose(Range("A1").Resize(, 6))), ",")
[COLOR=navy]For[/COLOR] n = Lst To 2 [COLOR=navy]Step[/COLOR] -1
   [COLOR=navy]With[/COLOR] Range("A" & n)
        [COLOR=navy]If[/COLOR] Txt = Join(Application.Transpose(Application.Transpose(.Resize(, 6))), ",") [COLOR=navy]Then[/COLOR]
                 .EntireRow.Delete
        [COLOR=navy]End[/COLOR] If
   [COLOR=navy]End[/COLOR] With
[COLOR=navy]Next[/COLOR] n
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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