Remove Duplicates

fari1

Active Member
Joined
May 29, 2011
Messages
362
hi,
i'm working over a code and a part of it includes removing the duplicates out of the source sheet and then put the fileterd results to the destination sheet.
i'm opting to make it a subroutine and will call in the original code that is run in the source sheet.

Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
hi, thank for reply, i want to run this remove duplicate code for the whole sheet not for just one column
 
Last edited:
Upvote 0
This should illustrate how to use RemoveDuplicates.
Code:
Sub RemoveDuplicates()
  Dim i As Integer
  For i = 1 To 10
    Range("A" & i).Value2 = i
    Range("B" & i).Value2 = i
  Next i
  
  'add a duplicate to row 2.
  Range("A2").Value2 = 1
  Range("B2").Value2 = 1
  
  'Copy usedrange to sheet2 and remove duplicates
  Sheet1.UsedRange.Copy Sheet2.Range("A1")
  Sheet2.UsedRange.RemoveDuplicates Array(1, 2), xlNo
End Sub
 
Upvote 0
Hello,
If you are using 2003 excel then use record and use advance filter then edit you are code as u required, Advance filter will filter all the data.

or

concatenate all the columns into one column and remove duplicate(delete entire row) either by countif formula or Advance filter.

for 2007 excel you can record macro and use a command called "Remove Duplicates" in Data tab in menu bar, use can select all columns if it suppose to delete the duplicates in entire column.

All the best
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,818
Members
452,946
Latest member
JoseDavid

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