![]() |
i want to delete duplicate items in a list using code.
I have a dynamic list of 2 columns wide in alphabetical order(all items are
text). The first column contains many different duplicate items (these are together as its in alpha order), the second column's items are all unique. I wish to delete the first of each of the duplicate items and close all gaps in order to reduce the length of the list. I am using Excel 2002. |
i want to delete duplicate items in a list using code.
search "unique" and then "empty rows" on John's site
http://www.j-walk.com/ss/excel/tips/misc.htm "ndm berry" wrote: I have a dynamic list of 2 columns wide in alphabetical order(all items are text). The first column contains many different duplicate items (these are together as its in alpha order), the second column's items are all unique. I wish to delete the first of each of the duplicate items and close all gaps in order to reduce the length of the list. I am using Excel 2002. |
i want to delete duplicate items in a list using code.
Sub aa() Dim lastrow As Long Dim i As Long lastrow = Cells(Rows.Count, 1).End(xlUp).Row For i = lastrow To 2 Step -1 If Cells(i, 1).Value = Cells(i - 1, 1).Value Then Cells(i, 1).Delete Shift:=xlShiftUp End If Next End Sub -- Regards, Tom Ogilvy "ndm berry" wrote in message ... I have a dynamic list of 2 columns wide in alphabetical order(all items are text). The first column contains many different duplicate items (these are together as its in alpha order), the second column's items are all unique. I wish to delete the first of each of the duplicate items and close all gaps in order to reduce the length of the list. I am using Excel 2002. |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com