How to delete that row if same cell in preceding row is identical

  • Thread starter Thread starter Ronmarco
  • Start date Start date
R

Ronmarco

I have data that duplicates a cell in the previous row and I want to delete
the second row each time that happens.
 
Sub NewOne()
Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.EntireRow.Delete Shift:=xlUp
ElseIf ActiveCell.Value <> ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top