I'm trying to remove duplicate values in columns in a range. For example, I have the following table (yes, looks like a transposed table):
How to remove the duplicate columns in the range B1:F3? The desired output will be like this one:
I tried the following piece of code but it's not working:
ActiveSheet.Range("$B$1:$F$3").RemoveDuplicates Columns:=Array(2, 3, 4, 5, 6), Header:=xlNo
I get a run-time error: Application-defined or object-defined error.


Array(1, 2, 3, 4, 5)because you are working within columns B:F. - user4039065