VBA Removeduplicates method bug

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Hi folks, remember me?

Having fairly recently upgraded to 2010 and not doing as much Excel stuff as before I've only just got round to messing with some of the newer stuff in VBA. One handy little tool that was introduced in 2007 onwards is the Removeduplicates method.

The help suggests that you can either use it like this :

Code:
ActiveSheet.Range("A1:C100").RemoveDuplicates Columns:=Array(1,2), Header:=xlYes

where you specifiy the columns that you want to remove duplicates from or like this:

Code:
 ActiveSheet.Range("A1:C100").RemoveDuplicates

where it will happily go off and remove duplicates from all columns in the range. Except it doesn’t.

It appears that you always have to pass the supposedly optional column array to the method for it to work which is really annoying (for me anyway).

I came across this suggestion: Erlandsen Data Consulting » Blog Archive » Remove Duplicate Items From A Worksheet Range

Has anyone else come up with a better workaround?

How does something like this make it through testing??? :oops:

Dom
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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