Ok guys, we want to make this:

to be like this:

Well, here is the code:
Public Function LastRow() As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, ActiveCell.Column).End(xlUp).Row
End With
End Function
Sub deldup()
For n = ActiveCell.Row To LastRow()
Do While (Cells(n, ActiveCell.Column).Value = Cells(n - 1, ActiveCell.Column).Value) And (Cells(n, ActiveCell.Column).Value <> "")
Rows(n).EntireRow.Delete
Loop
Next n
End Sub
to use this macro, just select the top of the row that we want to delete the duplicate cell, in this case is B3.
then just run the macro....done.
to be like this:
Well, here is the code:
Public Function LastRow() As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, ActiveCell.Column).End(xlUp).Row
End With
End Function
Sub deldup()
For n = ActiveCell.Row To LastRow()
Do While (Cells(n, ActiveCell.Column).Value = Cells(n - 1, ActiveCell.Column).Value) And (Cells(n, ActiveCell.Column).Value <> "")
Rows(n).EntireRow.Delete
Loop
Next n
End Sub
to use this macro, just select the top of the row that we want to delete the duplicate cell, in this case is B3.
then just run the macro....done.
Tidak ada komentar:
Posting Komentar