# VBA Removeduplicates method bug



## Domski (Apr 8, 2013)

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 :



```
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:



```
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??? 

Dom


----------

