Selective Search and Transfer

dccjr3927

New Member
Joined
Mar 20, 2017
Messages
5
I have two sheets, one the master with a UPC number column and a Product ID column. The other has only the UPC and inventory information. Not all rows have a product ID in the first sheet. I would like to have a script or macro go down the 2nd sheet at each UPC and see in a product ID is in the first sheet. If so, I would like to have in write the Product ID into the same row and a different column.

Any help would be greatly appreciated.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi & welcome to MrExcel.
A couple of questions
1) What are the sheet names?
2) What columns do we need to look at?
3) Do you have headers in row 1 with data starting in row 2?
 
Last edited:
Upvote 0
1.) The first sheet is Master Stock, the second is Inventory Count.
2.) On Master Stock, Column A is the UPC and Column H is the Product ID. On Inventory Count, Column A is the UPC.
3.) Master Stock has headers in Row 1, data starting in Row 2, In Inventory Count, data starts in Row 4.
 
Upvote 0
Ok, try this
Code:
Sub dccjr3927()
   Dim Cl As Range
   Dim Ws1 As Worksheet, Ws2 As Worksheet
   
   Set Ws1 = Sheets("Master Stock")
   Set Ws2 = Sheets("Inventory Count")
   Application.ScreenUpdating = False
   With CreateObject("scripting.dictionary")
      .CompareMode = 1
      For Each Cl In Ws1.Range("A2", Ws1.Range("A" & Rows.Count).End(xlUp))
         .Item(Cl.Value) = Cl.Offset(, 7).Value
      Next Cl
      For Each Cl In Ws2.Range("A4", Ws2.Range("A" & Rows.Count).End(xlUp))
         Cl.Offset(, 5).Value = .Item(Cl.Value)
      Next Cl
   End With
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top