Look for duplicate PH Number, and delete

The Idea Dude

Well-known Member
Joined
Aug 15, 2002
Messages
591
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I am new to access :)

I have a table called Main Database

One of the fields in this table is Phone Number

I would like to know what code will seek and destroy :) Well, look for duplicates of a phone number and then delete these records leaving only one record with this phone number in it.

Thanks heaps

(y)
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try this. It starts at the first line and compares a cell to the other cells in the column. If there is a match, the match row is deleted. Once through the first telephone number, it goes to the second and continues.

Sub ASD()
Dim Cntr1, Cntr2 As Integer
Cntr1 = 1
Do While Len(Range("A" & Cntr1 + 1)) > 0
For Cntr2 = Cntr1 + 1 To ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
If Range("A" & Cntr1) = Range("A" & Cntr2) Then
Rows(Cntr2).Delete
End If
Next
Cntr1 = Cntr1 + 1
Loop
End Sub
 
Upvote 0
whilst it wont automaticaly deltete them for you the is a find duplicates Query Wizard that will find them for you. Part of the problem of course is which of the duplicate to delete!
 
Upvote 0

Forum statistics

Threads
1,221,639
Messages
6,160,998
Members
451,682
Latest member
ogoreo

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