Return values from a list into separate sheet

jigoro

New Member
Joined
Feb 26, 2010
Messages
20
Office Version
  1. 365
Platform
  1. Windows
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name
[/TD]
[TD]Week 1
[/TD]
[TD]Week 2
[/TD]
[TD]Week 3
[/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[TD]y
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Phil
[/TD]
[TD][/TD]
[TD]y
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Julie
[/TD]
[TD][/TD]
[TD][/TD]
[TD]y
[/TD]
[/TR]
[TR]
[TD]Barry
[/TD]
[TD]y
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Michael
[/TD]
[TD][/TD]
[TD]y
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Karen
[/TD]
[TD][/TD]
[TD][/TD]
[TD]y
[/TD]
[/TR]
[TR]
[TD]Holli
[/TD]
[TD]y
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Nick
[/TD]
[TD][/TD]
[TD]y
[/TD]
[TD]y
[/TD]
[/TR]
[TR]
[TD]Kate
[/TD]
[TD][/TD]
[TD]y
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Hi,

I have a master excel sheet like the one above. I'm trying to populate a series of other sheets with the names of people where there is a Y in the week column. For example, my Week 1 tab would look like this (and so on for week 2, week 3 etc.):

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name
[/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[/TR]
[TR]
[TD]Barry
[/TD]
[/TR]
[TR]
[TD]Holli
[/TD]
[/TR]
</tbody>[/TABLE]

All help much appreciated.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub jigoro()
  Dim C As Long, LastCol As Long
  With Sheets("Master")
    LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column
    For C = 2 To LastCol
      .Columns(C).SpecialCells(xlConstants).Offset(, 1 - C).Copy Sheets(.Cells(1, C).Value).Range("A1")
    Next
  End With
End Sub[/td]
[/tr]
[/table]

Edit Note: I modified the code above to include the dot references (that I forgot in my first posting) back to the object of the With statement (the Master sheet). The above code is now correct.
 
Last edited:
Upvote 0
Thanks Rick. I'm not particularly familiar with macros but I'll give it a try.

Would there be a formula that could be used?
 
Upvote 0
Thanks Rick. I'm not particularly familiar with macros but I'll give it a try.
One note... I forgot to mention, my macro, as written, requires the sheets it is copying data to to already exist. If that will not be the case, I can modify it to create the sheets as needed.

As for your not being familiar with macros, see if the following helps.

HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (jigoro) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Thanks Rick,

I've managed to get it to work. Sort of. When the data in the master tab is changed, it doesn't update the other sheets fully. It will replace the data with new data, but doesn't delete the previous data i.e. if the master contains 4 names for week 1, when I change this to only 3 people it will leave the 4th name still in the week 1 tab.

Do you need to re-run the macro every time you update the data or does it do it automatically?

Thanks again for your help.
 
Upvote 0

Forum statistics

Threads
1,223,730
Messages
6,174,169
Members
452,548
Latest member
Enice Anaelle

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