+ Reply to Thread
Results 1 to 16 of 16

Copying list of names from one sheet to another

  1. #1
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Copying list of names from one sheet to another

    I have a list of 100 students. Beside each student's name is his teacher's name.
    There are 5 teachers.
    20 students per teacher.

    I would like to copy each student associated with each teacher to another worksheet.

    Column A is the Student Name
    Column B is the Teacher

    Student Name Teacher
    Joe Smith Mark Brown
    Jane Doe Mark Brown
    Mike James Mark Brown


    Hopefully you get what I mean.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    Hi Miles,

    I get the idea, but not sure how exactly you want the result to look.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    I've attached the sample. It has two teacher's class lists with their name in the top row. I don't need to have the teacher's names, just the Students.
    Attached Files Attached Files

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    Ok, so top row should be the teacher... the students below them. This is to be in a new sheet... does the code make the new sheet? or will the second sheet already exist?

  5. #5
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    It will already exist.....called "Class List.xls"

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    No I didn't mean workbook, you said "another sheet"?
    Or are we looking to open a SEPARATE workbook and pasting into a sheet on that?

  7. #7
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    Sorry, no, I meant to another workbook.

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    See if this works:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    the worksheet is called "main"

    I get an error on the first line of code - "subscript out of range"

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    so you changed "Sheet1" to "main" in this line? Set ws = ThisWorkbook.Worksheets("Sheet1")

    And the workbook with the sheet called main is the one with the code?

    And the one with the code is the sheet with the 2 columns (teacher and students in A and B)?

  11. #11
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    yes to all

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    are you sure the sheet name is an exact match? (no space in there by accident or anything?)
    Can you attach the file with the code in it by chance?

  13. #13
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    here's the line that is failing

    Please Login or Register  to view this content.

  14. #14
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    If the book with the code has a sheet called "main" then that won't error out. So either it is the wrong book, or there is something about the sheet name. Without the file (doesn't need much data, and can be fake names), I can't tell what is wrong.

  15. #15
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: Copying list of names from one sheet to another

    Well, I'm trying it now....no errors yet.
    will let you know if it works out

    thanks

  16. #16
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Copying list of names from one sheet to another

    Ok Hope it works out!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 05-12-2017, 09:24 AM
  2. Replies: 2
    Last Post: 01-07-2015, 07:15 PM
  3. Getting a list of Sheet Names by excluding certain Sheet Names instantenously..
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-09-2012, 12:16 PM
  4. Copying worksheets and giving them names from a growing list.
    By Testus in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-14-2011, 01:55 PM
  5. Copying a list of names without duplicates
    By timtread in forum Excel General
    Replies: 3
    Last Post: 03-11-2009, 02:35 PM
  6. Replies: 1
    Last Post: 11-27-2008, 11:11 AM
  7. [SOLVED] copying names to list depending on certain conditions
    By macca in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-21-2005, 07:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1