Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Dim wsCopy2 As Worksheet
  2. Dim wsDest2 As Worksheet
  3. Dim i As Integer
  4. Dim inrow As Integer
  5. Dim inmatch As String
  6. Dim inpax As Integer
  7. Dim k As Integer
  8. Dim outrow As Integer
  9. Dim outmatch As String
  10. Set wsCopy2= Workbooks("CargoReport1.xlsx").Worksheets("CargoReport")
  11. Set wsDest2 = Workbooks("w1.xlsm").Worksheets("Sheet1")
  12.  
  13. If wsCopy2.Range("c2") > 0 Then
  14.  
  15.  
  16. inrow = 1000
  17.  
  18.  
  19. For i = 2 To inrow
  20. inmatch = wsCopy2.Range("d" & i)
  21. If inmatch = "" Then
  22. Exit For
  23.  
  24.  
  25.  
  26. outrow = 1000
  27. For k = 2 To outrow
  28. outmatch = wsDest2.Range("A" & k)
  29. If outmatch = inmatch Then
  30. Exit For
  31. End If
  32.  
  33. If outmatch = "" Then
  34. wsDest2.Range("A" & k) = inmatch
  35. Exit For
  36. End If
  37. Next
  38.  
  39. If outmatch = inmatch Then
  40. Exit For
  41. End If
  42. Next
  43.  
  44. End If
  45. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement