Delete second duplicate rows

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
890
Hi all, i would like to write a vba so that to delete the second duplicate entire rows as my below extracts. In sch. 2. are the original data and on sch. 2. is the expected result.

Thanking you in advance





Sch.1.
7800005 ΙNDIVIDUALS
7800022-BUISINESS
7800022-BUISINESS
7800027-TOUR OPERATORS
7800035-CONFERENCES
7800035-CONFERENCES
7800068-FUNCTIONS
7800068-FUNCTIONS

<colgroup><col style="mso-width-source:userset;mso-width-alt:804;width:17pt" width="22"> <col style="mso-width-source:userset;mso-width-alt:5778;width:119pt" width="158"> <col style="mso-width-source:userset;mso-width-alt:2084; width:43pt" width="57" span="2"> </colgroup><tbody>
[TD="width: 22, align: center"][/TD]
[TD="width: 158, align: center"]A[/TD]
[TD="width: 57, align: center"]C[/TD]
[TD="width: 57, align: center"]D[/TD]

[TD="align: center"]1[/TD]
[TD="class: xl65"]31-12-17
[/TD]
[TD="class: xl66, align: center"]January[/TD]
[TD="class: xl66, align: center"]February[/TD]

[TD="align: center"]2[/TD]

[TD="class: xl66, align: center"]7,800[/TD]
[TD="class: xl66, align: center"]6,500[/TD]

[TD="align: center"]3[/TD]

[TD="class: xl66, align: center"] [/TD]
[TD="class: xl66, align: center"] [/TD]

[TD="align: center"]4[/TD]

[TD="class: xl66, align: center"][/TD]
[TD="class: xl66, align: center"][/TD]

[TD="align: center"]5[/TD]

[TD="class: xl66, align: center"]3,282[/TD]
[TD="class: xl66, align: center"]2,155
[/TD]

[TD="align: center"]6[/TD]
[TD="colspan: 2"]7800027-TOUR OPERATORS[/TD]
[TD="class: xl66, align: center"][/TD]

[TD="align: center"]7[/TD]

[TD="class: xl66, align: center"]5,478[/TD]
[TD="class: xl66, align: center"]4,578[/TD]

[TD="align: center"]8[/TD]

[TD="class: xl66, align: center"][/TD]
[TD="class: xl66, align: center"][/TD]

[TD="align: center"]9[/TD]

[TD="class: xl66, align: center"] [/TD]
[TD="class: xl66, align: center"]1,258
[/TD]

[TD="align: center"]10[/TD]

[TD="class: xl66, align: center"][/TD]
[TD="class: xl66, align: center"][/TD]

</tbody>


Sch.2.
7800005 ΙNDIVIDUALS

<colgroup><col style="mso-width-source:userset;mso-width-alt:804;width:17pt" width="22"> <col style="mso-width-source:userset;mso-width-alt:5778;width:119pt" width="158"> <col style="mso-width-source:userset;mso-width-alt:2084; width:43pt" width="57" span="2"> </colgroup><tbody>
[TD="width: 22, align: center"][/TD]
[TD="width: 158, align: center"]A[/TD]
[TD="width: 57, align: center"]C[/TD]
[TD="width: 57, align: center"]D[/TD]

[TD="align: center"]1[/TD]
[TD="class: xl65, align: center"]31-12-17
[/TD]
[TD="class: xl66, align: center"]January[/TD]
[TD="class: xl66, align: center"]February
[/TD]

[TD="align: center"]2[/TD]

[TD="class: xl66, align: center"]7,800[/TD]
[TD="class: xl66, align: center"]6,500
[/TD]

[TD="align: center"]3[/TD]
[TD="align: center"]7800022-BUISINESS[/TD]
[TD="class: xl66, align: center"] [/TD]
[TD="class: xl66, align: center"] [/TD]

[TD="align: center"]4[/TD]
[TD="align: center"]7800027-TOUR OPERATORS
[/TD]
[TD="class: xl66, align: center"]3,282[/TD]
[TD="class: xl66, align: center"]2,155
[/TD]

[TD="align: center"]5[/TD]
[TD="align: center"]7800035-CONFERENCES[/TD]
[TD="class: xl66, align: center"]5,478[/TD]
[TD="class: xl66, align: center"]4,578[/TD]

[TD="align: center"]6[/TD]
[TD="align: center"]7800068-FUNCTIONS
[/TD]
[TD="class: xl66, align: center"] [/TD]
[TD="class: xl66, align: center"]1,258[/TD]

</tbody>
 
Considering the example converting the range into a table, it is Excel that does this automatically - it's a built-in feature.
Someone at Microsoft created the code that keeps only the first instance up.
We, users, do not have to do anything, just follow the steps. :)

M.
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Well done oldb!! 72 years and you improve your knowledge!! well done once again and all the best to you!!
 
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