Macro to match cell value to worksheet name and copy row data

stephenp1983

New Member
Joined
Jul 10, 2013
Messages
9
I'm trying to create a macro that will look at the values in a column on worksheet1, and then copy the values from that row to worksheets whose name matches the value of the column. An example is below:

Main worksheet is named all. It has four columns (Name, Address, Location, Owner) The owner column has multiple values, each appearing on multiple rows. I have addditional worksheets created and named after all the possible values in the owner column (team 1, team 2, team 3). I would like the macro to copy the data in each row to the worksheet tab that matches the owner column value.

I found this thread, but it appears to be a little different from what I'm trying to accomplish -
http://www.mrexcel.com/forum/excel-...ons-match-cell-value-worksheet-name-copy.html

[TABLE="width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Address[/TD]
[TD]Location[/TD]
[TD]Owner[/TD]
[/TR]
[TR]
[TD]server1[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team1[/TD]
[/TR]
[TR]
[TD]server2[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team2[/TD]
[/TR]
[TR]
[TD]server3[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team3[/TD]
[/TR]
[TR]
[TD]server4[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team3[/TD]
[/TR]
[TR]
[TD]server5[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team3[/TD]
[/TR]
[TR]
[TD]server6[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 3[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team1[/TD]
[/TR]
[TR]
[TD]server7[/TD]
[TD]random address[/TD]
[TD][TABLE="width: 59"]
<tbody>[TR]
[TD="width: 59"]office 3[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]team1[/TD]
[/TR]
</tbody>[/TABLE]
 
Mumps, I've add the changes and now get an immediate run time error 424 object required. It seems to be pointing to the ws.activiate line. Thanks again for all your help

I see to have found the issue here, should have noticed it before - had to add 1 to ws1.activiate since there are two instances now.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is everything working the way you wanted now?
 
Upvote 0

Forum statistics

Threads
1,223,920
Messages
6,175,376
Members
452,638
Latest member
Oluwabukunmi

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