There is this old thread that provides a solution to delete duplicated rows, Delete all duplicate rows Excel vba .But if i use it on the data as shown below, that solution doesn't work as intended. Although i can add .End(xlDown) such that Set rng = Range("A1", Range("E1").End(xlDown).End(xlDown.End(xlDown) to delete the duplicated rows(Device A) that are separated in the screenshot, is there a better way to do it?
Another question that i want to clarify is what is the meaning of rng.RemoveDuplicates Columns:=Array(1, 2)? Because even if i put it as = Array(1) or even Array(1,2,3,4,5) i realised it will still delete the duplicated rows.
Sub test()
With Worksheets("Output")
Set rng = Range("A1", Range("E1").End(xlDown))
rng.RemoveDuplicates Columns:=Array(1, 2), Header:=xlNo
End With
End Sub