Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Code Duplicate items. Amy Excel Discussion (Misc queries) 5 September 10th 08 07:28 PM
Lookup duplicate items in a list Niall Excel Worksheet Functions 5 September 6th 08 03:06 AM
Display only duplicate values and delete UNIQUE Items WYMMIY Excel Discussion (Misc queries) 2 August 25th 08 12:50 PM
Check for duplicate items and delete them chanse44 Excel Discussion (Misc queries) 4 April 2nd 08 01:06 AM
Checking for duplicate items in list TheRobsterUK Excel Worksheet Functions 3 November 10th 05 06:03 PM


All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"