I am trying to remove duplicates, and after removing I need to shift cells up. The below works, but unfortunately it does not shift anything up. It leaves the empty rows.
Someone said to replace Columns:=Array(1) with Columns:=1, but that did not work.
Sub Macro3()
Range("A15").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub
CodePudding user response:
It looks like you are selecting multiple columns and then only passing one column in the remove duplicates argument. Here is an example that removes more than one columns duplicates and shifts up.
ActiveSheet.Range("A:C").RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
If you just want to remove one column then your code works minus the xlToRight:
Range("A15").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.RemoveDuplicates Columns:=1, Header:=xlYes