VBA copy data from sheet1 to sheet2 using cross-reference table

Old-One

New Member
Joined
Jun 30, 2013
Messages
8
I need to transfer data (values) from Sheet1, listed as Stock #’s to Sheet2, listed as Inventory #’s, using the cross-reference table on Sheet3.


The number of columns of data in each row could range from around 10 columns to about 50 columns, so it would be nice if the VBA could copy from the first cell to the right of the Stock # to the last cell containing a value and paste that into Sheet2. There are also blank cells in each row.

I tried to use FIND, to make it process quickly since there are hundreds of rows of data in the actual spreadsheets but could not figure how to reference the tables on Sheet3.


It seems simple enough but I can’t seem to make it work. Maybe, I need to give up trying to use FIND and use something else, but I’m not sure what. Any assistance would be greatly appreciated.

Sheet1 – Original Data
[TABLE="width: 459"]
<tbody>[TR]
[TD]Stock #[/TD]
[TD]1/28/2012[/TD]
[TD]2/28/2012[/TD]
[TD]3/28/2012[/TD]
[TD]4/28/2012[/TD]
[TD]5/28/2012[/TD]
[TD]6/28/2012[/TD]
[/TR]
[TR]
[TD]3768LK[/TD]
[TD]1.89[/TD]
[TD]1.73[/TD]
[TD]1.98[/TD]
[TD]1.57[/TD]
[TD]2.03[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]KJ 3-478[/TD]
[TD]2.13[/TD]
[TD][/TD]
[TD]2.98[/TD]
[TD]1.88[/TD]
[TD]1.67[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]M-y78[/TD]
[TD]0.98[/TD]
[TD]1.06[/TD]
[TD]1.22[/TD]
[TD][/TD]
[TD]3.76[/TD]
[TD]1.87[/TD]
[/TR]
[TR]
[TD]tt-67[/TD]
[TD]1.03[/TD]
[TD]2.28[/TD]
[TD]1.87[/TD]
[TD][/TD]
[TD]1.35[/TD]
[TD]1.47[/TD]
[/TR]
[TR]
[TD]9-7-HE[/TD]
[TD]2.28[/TD]
[TD]2.66[/TD]
[TD]1.89[/TD]
[TD]1.21[/TD]
[TD]3.56[/TD]
[TD]2.95[/TD]
[/TR]
[TR]
[TD]8-PM-9[/TD]
[TD]2.80[/TD]
[TD][/TD]
[TD][/TD]
[TD]3.78[/TD]
[TD]2.22[/TD]
[TD]2.73[/TD]
[/TR]
</tbody>[/TABLE]

Sheet2 – Need to transfer data from Sheet 1 to Sheet 2 using cross-reference table (Sheet3)
[TABLE="width: 459"]
<tbody>[TR]
[TD]Inventory #[/TD]
[TD]1/28/2012[/TD]
[TD]2/28/2012[/TD]
[TD]3/28/2012[/TD]
[TD]4/28/2012[/TD]
[TD]5/28/2012[/TD]
[TD]6/28/2012[/TD]
[/TR]
[TR]
[TD]378-065-6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]431-67-1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]578-004-32[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]696-0235-1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]727-34-34[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]886-563-3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Sheet3 – cross-reference from Stock # to Inv #
[TABLE="width: 180"]
<tbody>[TR]
[TD]Stock #[/TD]
[TD]Inventory #[/TD]
[/TR]
[TR]
[TD]3768LK[/TD]
[TD]431-67-1[/TD]
[/TR]
[TR]
[TD]KJ 3-478[/TD]
[TD]578-004-32[/TD]
[/TR]
[TR]
[TD]M-y78[/TD]
[TD]378-065-6[/TD]
[/TR]
[TR]
[TD]tt-67[/TD]
[TD]886-563-3[/TD]
[/TR]
[TR]
[TD]9-7-HE[/TD]
[TD]727-34-34[/TD]
[/TR]
[TR]
[TD]8-PM-9[/TD]
[TD]696-0235-1[/TD]
[/TR]
</tbody>[/TABLE]

Thank you for your assistance.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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