+ Reply to Thread
Results 1 to 38 of 38

Transferring data between 2 workbooks

  1. #1
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Transferring data between 2 workbooks

    I have a workbook with 9 sheets that each contain a list of names. Each day the lists are updated. I have a second file with two worksheets that are updated daily based on the names in the first file. The names from 8 sheets go onto one sheet in the second file and the names from 1 sheet go to the second sheet. I would like to automate the population of the second file.

    Is this possible?

    Thanks

    Jeff

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    We will need much more information to suggest a solution. It would be easier to help and test possible solutions if you could attach a copy of both files. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach your files.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I have attached the workbooks and a simple flow chart.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Make sure that both workbooks are open. Place this macro in the code module for ThisWorkbook. Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook" of the Roll Call file. Copy/paste the macro into the empty window that opens up. Close the window to return to your sheet. Enter a name in column A of any of the sheets in Roll Call and press the RETURN key or TAB key. The names will be automatically copied to the Data Flow file.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    Great - Thanks for your help!

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    You are very welcome.

  7. #7
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I just found out I need have a couple criteria when copying the data.

    1 - In the "Roll Call - Test" file, I only want to copy the name if there is data in the column called Shift. If that cell is blank, I don't copy the name
    to the "Honda Security List" file.

    2 - In the "Roll Call - Test" file, I don't need to copy the names from 2 sheets - KTH and Nissan. These sheets can be ignored.

    How would I go about this?
    Attached Files Attached Files

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Do you want the names Under "TEMPORARY ASSOCIATES" or under "ASSEMBLE-RITE ASSOCIATES" in the "HCM" sheet?

  9. #9
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    The names can start at the top of the column. The cells that say "temporary associates" & "Assemble-Rite Associates" can be removed.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Try:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I copied this into the module for ThisWorkbook but nothing is being copied.

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    I tested the macro using the last two files you posted and it works properly. Do the names you are trying to copy have data in the corresponding "SHIFT" cell? Are you using the same two files you posted?

  13. #13
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I was typing the data in the wrong order. Operator error on my part. Works great!

    If I wanted the names to start at the top of the column on the Security sheet, what would have to be changed?

    Thanks

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    I don't see the Security sheet in either file.

  15. #15
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I have attached the Security file.
    Attached Files Attached Files

  16. #16
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Ytu:
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    Awesome! Thanks again!

  18. #18
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    My pleasure.

  19. #19
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I just realized that when the names are copied to the "HCM" sheet in the Honda Security List file, the data is only populating the first row. Each time the previous name is written over. However it works fine on the "SPS" sheet in the same file.

  20. #20
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Replace his line of code:
    Please Login or Register  to view this content.
    with this line:
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    Awesome! Thanks!

  22. #22
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    You are very welcome.

  23. #23
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    Hi,

    I've combined the 2 workbooks into 1 to simplify. Is there a way to be able to enter the names first then the data in the shift column for the code to work?
    I've attached the updated workbook.

    Thanks
    Attached Files Attached Files

  24. #24
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Try:
    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I didn't explain my question clearly. This revised code copies the cell contents from the "Shift" column. How would I copy the info from the "Name" column?

    Thanks

  26. #26
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    I'm not sure what you mean. The current macro already copies the shift and name from SPS to SPS (2) and the name from the other sheets to HCM.

  27. #27
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    I don't need the shift copied over, just the name.

  28. #28
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Try:
    Please Login or Register  to view this content.

  29. #29
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    This is copying the data from the "Shift" column. How would I copy the data from the "Name" column?

  30. #30
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Try:
    Please Login or Register  to view this content.

  31. #31
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    Awesome! Works great!

    Next question - If I copy the names and shift from a different sheet and paste the names & shift into the sheets, how can I get the names to copy to the HCM & SPS (2) sheets if there is data in the shift column?

  32. #32
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    If I copy the names and shift from a different sheet
    What is the name of the "different sheet"? Attach an updated file that contains that sheet if necessary.
    Last edited by Mumps1; 06-08-2021 at 07:55 AM.

  33. #33
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    The name of the sheet the info comes from changes every day.

  34. #34
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Is the sheet name completely different each day or does it only change in part? If it changes in part, what is the part of the name that remains constant? Is it's position in the workbook always the same and if so, what position is it in? For example, is it always the last sheet? We need some way of identifying the sheet so that it can be excluded from triggering the macro.

  35. #35
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    The name is completely different each day.

  36. #36
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    I can't help unless you are able to answer all the questions in Post #34 and the following question as well:
    When you copy the names and shift from the different sheet, are the names and shift in columns A and B?

  37. #37
    Registered User
    Join Date
    05-02-2018
    Location
    Ontario
    MS-Off Ver
    2103
    Posts
    19

    Re: Transferring data between 2 workbooks

    The file name changes in part. Eg: A Shift Roll Call - 6/14/21 to A Shift Roll Call - 6/15/21. However, not all the info is in the sheet everyday. Some days, part of the information comes as text in an email.
    The sheets in the file stay in the same order.
    The names and shift info are in the columns - A & B.

  38. #38
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Transferring data between 2 workbooks

    Try:
    Please Login or Register  to view this content.

+ 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. Transferring master file data to multiple workbooks and naming them
    By sparkyster in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-01-2018, 09:35 AM
  2. Matching and transferring data for 2 workbooks
    By hohofaye in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2017, 10:49 AM
  3. HELP! Transferring Rows of Multiple Data Between Workbooks
    By chicity26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2014, 11:25 AM
  4. Transferring Data from Multiple Workbooks to a Master Workbook
    By Stopwatch in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-28-2013, 08:23 PM
  5. Do Until Loop - Transferring data from several workbooks to a Master workbook
    By GalsenPAP in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-10-2013, 01:00 PM
  6. Problem with transferring data between workbooks
    By Stogart82 in forum Excel General
    Replies: 2
    Last Post: 01-26-2009, 03:03 PM
  7. Transferring data IN VBA between workbooks
    By Q in forum Excel General
    Replies: 1
    Last Post: 03-06-2005, 11:06 PM

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