VBA Excel: How to remove duplicates in 2 columns
duplicates, excel, range, vba
Solution
Remove the parenthesis when calling RemoveDuplicates if the function is not returning any value, like this:
selection.RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
Problem
I have the following below, but I'm having issues with the syntax. I want to set the current selection as a range, and I want to remove duplicates from that selection. How can I do this? ``` 'remove duplicates Columns("B:C").Select Dim duplicates As Range Set duplicates = Selection ActiveSheet.duplicates.RemoveDuplicates(Columns:=Array(1, 2), Header:=xlYes) ```