0
votes

I currently have a code where my duplicates will be removed based off of one column. I would like to join column 1 and column 2 as strings (I think that would be the easiest way) and remove the duplicates. Currently I have the code:

Range("A1:A6").RemoveDuplicates Columns:=1, Header:=xlNo

I would like to have it so it compares column 1 and column 2 TOGETHER.

For example Column 1 has:

(A1) Apple
(A2) Pear
(A3) Pear
(A4) Apple

Column 2 has:

(B1) Red
(B2) Blue
(B3) Blue
(B4) Orange

In this case, only Row 2 and Row 3 are duplicates. Not Row 1 and Row 4 because you would be comparing two columns instead of one.

Thank you! Hope this made sense.

1

1 Answers

1
votes

Include the whole range and use Array to include both columns:

Range("A1:B6").RemoveDuplicates Columns:=Array(1,2), Header:=xlNo