In column 'M' i have hundreds of rows with multiple duplicates. I only want one record to show per duplicate when i run my macro. Below is my code and it deletes all records apart from one.
Sub DeleteRows()
With ActiveSheet
Set Rng = Range("M5:M").End(xlDown)
Rng.RemoveDuplicates Columns:=1, Header:=xlYes
End With
End Sub
It starts from M5 as this is where the data is initially. Why would it only be showing one record?
Set Rng = Range("M5").End(xlDown)is one cell.ActiveSheetand instead define which sheet you are referencing through it'sCodeName. Then input a dot (.) in front of all references to be explicit, e.g:.Range(...