I was wondering if anyone knows how to delete repeated rows.. Say for example,
A B C
1 1 3 4
2 2 6 9
3 TEST 1 2
4 TEST 1 2
5 Both 1
6 Hi 2
7 None 3 3
8 Loud 4 4
For the particular example above, TEST was repeated twice.. In some other cases, the name can be some other kinds such as NOON, Morning, etc.. And row 8 does not necessary be the last row. I have no idea of how to compare the rows to check for repeated names and then delete them away. I need to run a macro with this and so i will need VBA. If you know it, please share it with me.. Will be thankful!
Attempt for codes:
Sub Macro1()
Dim LastRow As Long, n As Long, rowstodelete As Long
LastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For n = 1 To LastRow
With Worksheets("Sheet1").Cells(n, 1)
If .Cells(n, 1) = .Cells(n + 1, 1) Then
rowstodelete = Worksheets("Sheet1").Cells(n, 1)
Rows(rowstodelete).Select
Selection.Delete Shift:=xlUp
End If
End With
Next n
End Sub
Unfortunately, there were runtime error over at the .Cells(n, 1).. I have no idea why it is.. if you know something can share with me or modify it alittle. will be thankful!