Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Dim x, x2, y, y2()
  2. Dim i As Long
  3. Dim dict As Object
  4. Dim LastRowTwo As Long, shtOrders As Worksheet, shtReport As Worksheet
  5.  
  6. Set shtOrders = Worksheets("Orders")
  7. Set shtReport = Worksheets("Mapping")
  8. Set dict = CreateObject("Scripting.Dictionary")
  9.  
  10. With shtReport
  11. LastRow = .Range("G" & Rows.Count).End(xlUp).Row
  12. x = .Range("G2:G" & LastRow).Value
  13. x2 = .Range("I2:I" & LastRow).Value
  14.  
  15. Set SelectionRNG = Worksheets("Mapping").Range("G2:J" & LastRow)
  16.  
  17. For Each rngrow In SelectionRNG.Rows
  18.  
  19. If rngrow.Cells(1, 4) = "100" Then
  20. dict.Item(x(i, 1)) = x2(i, 1)
  21.  
  22. End If
  23. Next
  24. End With
  25.  
  26. dict.Item(x(i, 1)) = x2(i, 1)
  27.  
  28. For i = 1 To UBound(x, 1)
  29. dict.Item(x(i, 1)) = x2(i, 1)
  30. Next i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement