Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. Dim KeyCells As Range
  3. Set KeyCells = Range("B7:B100000")
  4. If Not Application.Intersect(KeyCells, Range(Target.Address)) _
  5. Is Nothing Then
  6.  
  7. Call LoopMatch
  8. End If
  9.  
  10. End Sub
  11. Sub LoopMatch()
  12. Dim Scanned, NotScanned As Range
  13. Dim i, j As Range
  14. Set Scanned = Worksheets("Main").Range("C7:C100000")
  15. Set NotScanned = Worksheets("Main").Range("J7:J100000")
  16.  
  17. For Each i In Scanned.Cells
  18. For Each j In NotScanned.Cells
  19. If i.Value = j.Value Then
  20. Range("J" & j.Row & ":L" & j.Row).Delete
  21. Exit Sub
  22. Else
  23. End If
  24. Next j
  25. Next i
  26.  
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement