Paste values to cells in sheet2 based on header match in sheet1

sshugar

New Member
Joined
Oct 18, 2013
Messages
5
I need vba code guru's help to figure this out.
We have a excel sheet that has column headers MIC and Version.
Sheet1:

[TABLE="width: 795"]
<tbody>[TR]
[TD="colspan: 4"]SCRNHYF1[/TD]
[TD="colspan: 4"]SCRNRBF1[/TD]
[TD="colspan: 4"]SCRNEBF1[/TD]
[/TR]
[TR]
[TD]MIC[/TD]
[TD]Version[/TD]
[TD]Lower Limit[/TD]
[TD]Upper Limit[/TD]
[TD]MIC[/TD]
[TD]Version[/TD]
[TD]Lower Limit[/TD]
[TD]Upper Limit[/TD]
[TD]MIC[/TD]
[TD]Version[/TD]
[TD]Lower Limit[/TD]
[TD]Upper Limit[/TD]
[/TR]
[TR]
[TD]50015357[/TD]
[TD]1[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50015357[/TD]
[TD]1[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50015359[/TD]
[TD]1[/TD]
[TD]90[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50015358[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50015358[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50015360[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50014016[/TD]
[TD]3[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50014016[/TD]
[TD]3[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50014016[/TD]
[TD]1[/TD]
[TD]90[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50010606[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50010606[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50010606[/TD]
[TD]15[/TD]
[TD]0[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50000779[/TD]
[TD]3[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50000779[/TD]
[TD]3[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50000779[/TD]
[TD]16[/TD]
[TD]90[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50010608[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50010608[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50010608[/TD]
[TD]15[/TD]
[TD]0[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50150795[/TD]
[TD]1[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50150795[/TD]
[TD]1[/TD]
[TD]95[/TD]
[TD]100[/TD]
[TD]50150795[/TD]
[TD]2[/TD]
[TD]90[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]50150796[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50150796[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]100[/TD]
[TD]50150796[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]100[/TD]
[/TR]
</tbody>[/TABLE]


I would like VBA code to rearrange data in sheet1 to sheet2 as shown below.
Please note: We have these MIC and Version header repeat many times in sheet1.
Sheet2:

[TABLE="width: 203"]
<tbody>[TR]
[TD]RoS[/TD]
[TD]MIC[/TD]
[TD]Ver[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50015357[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50015358[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50014016[/TD]
[TD] 3[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50010606[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50000779[/TD]
[TD] 3[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50010608[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50150795[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNHYF1[/TD]
[TD]50150796[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50015357[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50015358[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50014016[/TD]
[TD] 3[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50010606[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50000779[/TD]
[TD] 3[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50010608[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50150795[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNRBF1[/TD]
[TD]50150796[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50015359[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50015360[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50014016[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50010606[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50000779[/TD]
[TD] 16[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50010608[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50150795[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]SCRNEBF1[/TD]
[TD]50150796[/TD]
[TD] 2[/TD]
[/TR]
</tbody>[/TABLE]



Thanks in advance.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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