SHARE
TWEET

Untitled

a guest Jun 26th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub RemoveDuplicates()
  2.  
  3. Application.ScreenUpdating = False
  4.  
  5. Dim LR As Long, i As Long
  6. Dim AcctSearchRange As Range
  7. Dim AcctFindRange As Range, C As Range, Cel As Range, D As Range
  8. Dim AcctValueToFind As Variant
  9. Dim SubValueToFind As Variant
  10. Dim CurrentSheet As Worksheet
  11. Dim xlSheet As Worksheet, Xfound As Boolean
  12. Dim firstAddress  As String
  13.  
  14.  
  15. Set CurrentSheet = ActiveWorkbook.ActiveSheet
  16. Set xlSheet = ActiveWorkbook.Worksheets("CurrentBSCOA")
  17. Set AcctSearchRange = xlSheet.Range("E1:E" & xlSheet.Range("E" & Rows.Count).End(xlUp).Row)
  18. Set AcctFindRange = CurrentSheet.Range("C1:C" & CurrentSheet.Range("C" & Rows.Count).End(xlUp).Row)
  19.  
  20.  
  21. LR = Range("A" & Rows.Count).End(xlUp).Row
  22.  
  23. Range("A" & Rows.Count).End(xlUp).Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlYes, Key2:=Range("D1"), Order2:=xlAscending, Header:=xlYes, Key3:=Range("E1"), Order3:=xlAscending, Header:=xlYes
  24. For i = LR To 1 Step -1
  25.    ***If (Range("C" & i) = Range("C" & i - 1) And Range("D" & i) = Range("D" & i - 1)) Then Rows(i).Delete***
  26. Next i
  27. Range("A" & Rows.Count).End(xlUp).Sort Key1:=Range("C1"),  Order1:=xlAscending, Header:=xlYes, Key2:=Range("D1"), Order2:=xlAscending, Header:=xlYes, Key3:=Range("E1"), Order3:=xlAscending, Header:=xlYes
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top