VBA - Eliminate duplicate numbers in a column and leave original only

skyport

Active Member
Joined
Aug 3, 2014
Messages
374
What is needed here on this one is assuming column A will contain a list of telephone numbers entered in this format: (xxx) yyy-zzzz which is how it would appear in the formula bar if the cell were selected, a macro that would eliminate all duplicates but the most important aspect would be to always retain the first entry of the number in column A and only eliminate any and all subsequent duplicate entries of same numbers.

the final twist if possible, although not critical, would be to show in column C those duplicate numbers that were eliminated from column A when the Macro runs.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
4444
5555
6666
4444
99original data99
9898
9797
9999
7171
7272
macro to find duplicates
For j = 1 To 10
Number = Cells(j, 1)
For k = j + 1 To 10
If Cells(k, 1) = "" Then GoTo 100
If Cells(k, 1) = Number Then Cells(k, 4) = Cells(k, 1): Cells(k, 1) = ""
100 Next k
Next j
End Sub

<colgroup><col width="64" span="13" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Good morning Oldbrewer and sirDextor, Thank you both for helping. Here is what I am running into with each one and please note I am using Excel 2000 as well.

With Oldbrewer's code, it does't seem to to show in the selection of macros to use when ALT F8 is used after it has been inserted in a new module from ALT F11. Therefore I am unable to even test it yet.

With sirDextor's code, it does show up in the menu window from ALT F8 however when I run it I am getting the following error message:

run-time error 438 Object doesn't support this property or method

Any suggestions would be greatly appreciated.
 
Upvote 0
how i write a macro

tools, record new macro, click on cell A1, stop macro

tools, macro, edit, delete the single line of code that selected A1 and type in your macro (or copy it in)

go back to spreadsheet and run it

debug as necessary
 
Upvote 0

Forum statistics

Threads
1,221,448
Messages
6,159,922
Members
451,604
Latest member
SWahl

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