I worked with RemoveDuplicates and cannot find any other way than to hard code the columns settings. This is code would work:
Worksheets("SheetName").Activate
ActiveSheet.Range("A:Z").RemoveDuplicates _
Columns:=VBA.Array(1, 2, 3), _
Header:=xlYes
But this code would throw "runtime error 5":
Dim ArrayColumns() As Variant
ArrayColumns = VBA.Array(1, 2, 3)
Worksheets("SheetName").Activate
ActiveSheet.Range("A:Z").RemoveDuplicates _
Columns:=ArrayColumns, _
Header:=xlYes
As I actually would like to use an array with 100+ entries that might even change over time, I am not so happy with the first solution.
Can you help me?
Cheers, Peter