Advertisement
max_tre

DelRows

Sep 2nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub DelRows()
  2.     Application.ScreenUpdating = False
  3.     Dim LastRow As Long
  4.     LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
  5.     Dim x As Long
  6.     For x = LastRow To 2 Step -1
  7.         If Cells(x, 1) = Cells(x - 1, 1) Then
  8.             If Cells(x,2) = Cells(x - 1, 2) Then
  9.                 Rows(x).EntireRow.Delete
  10.             End If
  11.         End If
  12.     Next x
  13.     Application.ScreenUpdating = True
  14. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement