Master list to sub-lists

Barry Katcher

Well-known Member
Joined
Feb 25, 2002
Messages
4,053
Hello, people.

I have a tab with a master list of all the students in my school, including a column with their class. I have ten tabs for the individual classes. Can someone help me with a formula to use in the individual class tabs to bring over the student's name from the master list and place it in the appropriate class tab? Each class has between 4 and 12 kids in it, all of them on the master list.

All I need is the name - once I have that, I can use a VLOOKUP to bring over all of their other information.

Thanks,

Barry
 
Last edited:
Peter - I set up my tabs, imported your macro, and got an error message:
Run-time error '9', Subscript out of range.

When I de-bugged, it was hung up on this line:
.Rows(i).Copy Destination:=Sheets("Class " & .Range("R" & i).Value).Range("A" & Rows.Count).End(xlUp).Offset(1)

The master list tab is named "Master" (without the quotes), and all of the class tabs begin with "Class", followed by a space.

The sample below is the actual layout of the Master and of the Classes. I did hide some columns in the center so it will display on the screen.

When run, all the info from the Master, col A:Q, starting with line 2, should transfer to its respective class tab, starting in row 5, determined by the class number in col. R of the Master.

What do you think needs fixing in the macro?

Thanks, Barry

_Denise_VLOOKUP_VBS_test_macro.xls
ABCDEFG
10Tabname"Master"AllinfofromMastershouldflowtoClass
11ABCQRS
121(ThisiscellA1)LastNameFirstNameChurchNameClassClassName
132Acevedo,EthanAcevedoEthan-1-bChillin'Outers
143Acevedo,GabrielAcevedoGabriel-5-aSurfers
154Adams,DavidAdamsDavidSt.AndrewsPres.3-aSkinDivers
165Adams,LindseyAdamsLindseySt.AndrewsPres.6-aWipeOuters
176Agate,GageAgateGageFaithK-bWaterSplashers
18
19
20Tabname"Class5-aSurfers"
21ABCQ
221(ThisiscellA1)Surfers
232SandyAllison
243Student
254KeyLastNameFirstNameChurchName
265
276
287
Sheet2
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
That means that one of the Class sheets does not exist. You'll need to carefully check the spelling of each one (for example no leading or trailing spaces in the sheet name).
 
Upvote 0
Aha! I do have several other tabs, other than the Master and the various classes, such as Teachers and Instructions. Could that be it?

If so, can I correct that by renaming Teachers to Class Teachers and Instructions to Class Instructions?

Also, I'm not clear on how the macro knows which rows to take from the Master and put them into their proper tab. Could you possibly explain that to me? Do I have to change the data in column R on the Master from, say, 5-a to Class 5-a or to Class 5-a Surfers , or is that not necessary?

Thanks for your patience, Peter.

Barry
 
Upvote 0
It loops down the Master sheet, looks at column R for the class name then tries to copy that whole row to the Class sheet. So if it finds 5-a in column R it tries to copy that row to a sheet called "Class 5-a" (without the quotes).

If the value in column R contains leading or trailing spaces, it will fail.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

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