Advertisement
YasserKhalil2019

T4702_Compare Two Columns Using Find Method

Mar 25th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. https://excel-egy.com/forum/t4702
  2. ---------------------------------
  3.  
  4. Sub Compare_Two_Columns_Using_Find_Method()
  5. Dim c As Range, m As Long, r As Long, t As Long
  6.  
  7. Application.ScreenUpdating = False
  8. Columns(2).Interior.Color = xlNone
  9. Columns(3).ClearContents
  10. m = Range("B" & Rows.Count).End(xlUp).Row
  11.  
  12. For r = 2 To m
  13. Set c = Range("A:A").Find(What:=Range("B" & r).Value, LookAt:=xlWhole)
  14. If Not c Is Nothing And c <> Empty Then
  15. t = c.Row
  16. Range("C" & t).Value = Range("A" & t).Value
  17. Range("B" & r).Interior.Color = vbCyan
  18. End If
  19. Next r
  20. Application.ScreenUpdating = True
  21.  
  22. MsgBox "Done...", 64
  23. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement