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)
Remove the parenthesis when calling RemoveDuplicates if the function is not returning any value, like this:
selection.RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With