Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Excel macro for duplicate records 1

Status
Not open for further replies.

mav617

IS-IT--Management
Jul 14, 2003
18
0
0
GB
Hi,

I am new to macros in Excel, wondered if I could create one to remove duplicate records? I have two worksheets from different sources with some info repeated. Is there a way I can get the application to remove any duplicated records (other than doing it by 'sort by' and then manually picking them out?)
 
Use Auto-Filter:
select your data range, set data-filter-auto filter - advanced
select "no duplicates" and specify your output range.

Or use some code:
Code:
Sub SetFilter()
   Application.ScreenUpdating = False
   Range("A1").CurrentRegion.AdvancedFilter _
      Action:=xlFilterCopy, CopyToRange:= _
      Range("B1"), Unique:=True
   Columns(1).EntireColumn.Delete
   Application.ScreenUpdating = True
End Sub

Beware: Since this is about data deletion, don't forget to backup your file
;-)
And<

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Alternatively, you could just search the archives for "duplicate" where you'll find many, many threads that could help you out rather than just posting a question straight away

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top