+ Reply to Thread
Results 1 to 11 of 11

VBA Code to copy different data from one sheet to multiple sheets based on criteria

  1. #1
    Registered User
    Join Date
    09-30-2014
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    5

    VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hello,

    I am very new to VBA code and would greatly appreciate any help you are able to offer. I have a master contacts workbook and would like the ability to add new contacts to sheet 1 and then, based on criteria that was entered in specific columns, have that data automatically be added to the additional appropriate sheets within the workbook. I would like the spreadsheet to auto-update and I would also like for only the first couple of columns for each row to be copied over to additional sheets.

    I've attached an example spreadsheet. Eharwood_VBA code sample file.xlsx

    I have columns for first name, last name, and contact info. Then there are columns that tag the individual as a member/non-member and based on participation in various committees there is a yes or no for each committee column.

    For the first row of my example spreadsheet John Smith is a tagged as a member (per column H) and also a member of the Promotions committee (a yes in column K). Therefore, I would like the ability to have John Smith's information automatically added to the member sheet and also to the promotions sheet. I also only want to copy the info from columns A-G to each additional sheet in the workbook.

    Based on extensive googling below is the code that I am attempting to use, but I receive an error message and I also feel like there is a much more efficient way to accomplish the same thing. Any suggestions and help are greatly appreciated!

    Please Login or Register  to view this content.
    Thank you,
    Last edited by eharwood; 10-06-2014 at 04:09 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hi eharwood

    Welcome to the Forum!!!

    How many members will you have in the Master Sheet?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hi eharwood

    Try the Code in the attached. Please note, I've modified the Sheet Names of GRMCA Member and Non-Member Dropped the trailing "s"). This was done to make the Code less wieldy.

    I've also added Data Validation to Columns H through L. CTRL + x will fire the Code.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-30-2014
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    That works perfectly. Thank you so much!

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    09-30-2014
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hi Jaslake,

    One additional question. If I wanted to add additional sheets or categories to the spreadsheet, how would I alter the code to include the additional tabs? Thank you so much!

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hi eharwood

    The Code was written to accommodate the Sample File. I'd need to see what you'd be adding in order to modify the Code for this
    If I wanted to add additional sheets or categories to the spreadsheet, how would I alter the code to include the additional tabs

  8. #8
    Registered User
    Join Date
    09-30-2014
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    I understand, I've attached a new sample file. I'm adding an additional column to the master titled "industry" and a corresponding new sheet titled "industry". If possible if you can show me what you change in order to accommodate an additional tab then I would be able to edit the spreadsheet in the future if I need to add additional columns, without having to bother someone like yourself
    Eharwood_VBA code sample file.xlsx

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Hi eharwood

    If you're simply adding Yes/No questions the change appears rather simple...the new Column Heading needs to be the same as the new Sheet Name...
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-30-2014
    Location
    Atlanta
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    Ok got it, thank you so much for all your help! That worked perfectly and now I can add additional yes/no columns as needed.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code to copy different data from one sheet to multiple sheets based on criteria

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Code to copy a row from multiple sheets to a summary sheet per criteria
    By rmwindham in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-29-2014, 11:05 AM
  2. [SOLVED] VBA Code to copy data from one sheet and paste to multiple other sheets
    By JimmyG. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2013, 04:25 AM
  3. Search multiple sheets for value based on criteria and copy data accordingly
    By Zagadka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2012, 08:46 AM
  4. need help with code to copy data from multiple sheets to one sheet
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2012, 01:07 PM
  5. Copy data from multiple sheets based on certain criteria!!
    By missyk77 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-24-2010, 12:05 PM

Tags for this Thread

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