+ Reply to Thread
Results 1 to 13 of 13

Update multiple workbooks with data from one workbook

  1. #1
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Update multiple workbooks with data from one workbook

    Hello!

    Im trying to figure out if there is a way (ofcourse there is) to update data from one workbook to separate workbooks in separate sheets.
    The data to be updated is located in one spreadsheet. I have taken the data from this workbook and separated it into multiple workbooks and sheets.

    Once a week, new data is added to the sheet and I need to go through the process of pulling the new data (entire row with new date) of each category and placing it in the corresponding workbook/sheet. See illustration of what Im trying to do.

    In reality I have ~4-5 workbooks, each containgin ~8 sheets that needs to be updated.
    The letters A,B etc are in reality a string of 20 characters.

    Basically I want to pull the new data and insert it on top of each separated sheet

    This has probably been done before? Is there a VBA I could start looking at?
    Im new to VBA, so not really familiar with the coding required for this.

    Workbookupdate2.jpg

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    1) Can you provide an example workbook with the EXACT same kind of data to export, not oversimplified in any way? We are looking for a logical way we can identify the keyword that would be used in each output row to know which "group" it goes with.

    2) Are all the external workbooks in a specific dedicated folder?

    3) Are the sheets within each external workbook named for the exact same text strings we are truing to identify in step #1? (it's important they be an exact match to keep things simple)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Re: Update multiple workbooks with data from one workbook

    Thanks for the response

    1)
    Here is a link to the file that comes out with updated data once a week:
    http://www.cftc.gov/files/dea/histor...t_xls_2016.zip


    2)
    Yes, I have put all the workbooks in the same folder.

    3)
    In the linked file, the A column contains the string which is needed to separate the data into the correct sheet.
    So I need to specify which strings of column A goes to what workbook.

    Currently I have given the sheets a shorter name, I have simplified the sheet name for the data below to "Japanese Yen" for example.
    I can change the sheet names to match the full string of column A if its easier though.

    Example:
    JAPANESE YEN - CHICAGO MERCANTILE EXCHANGE

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    So is it accurate to say the sheet names are an exact match to the text found before the " - " string (up to 30 characters)?


    WHEAT-SRW - CHICAGO BOARD OF TRADE
    CORN - CHICAGO BOARD OF TRADE
    CALIFORNIA CARBON ALLOWANCE VINTAGE 2015 - ICE FUTURES ENERGY DIV
    CALIF CARBON ALL VINTAGE 2016 - ICE FUTURES ENERGY DIV
    PJM TRI-RECs CLASS 1 Vin 2017 - ICE FUTURES ENERGY DIV
    GULF # 6 FUEL 3.0% SULFUR SWAP - NEW YORK MERCANTILE EXCHANGE
    ALGONQUIN CITY-GATES FINANCIAL BASIS - ICE FUTURES ENERGY DIV

    etc?

    Since sheet names can only be 30 characters long and assuming no illegal characters will ever be there?
    Last edited by JBeaucaire; 10-11-2016 at 11:56 AM.

  5. #5
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Re: Update multiple workbooks with data from one workbook

    Yes they are a exact match. Can we reduce the amount of characters to 20 in the sheets if possible?

    so I have the sheet names limited to 20 characters:
    "CANADIAN DOLLAR - CH"

    edit:
    Sorry, I read your post wrong. The sheet names are actually as described above, the 20 first characters of the string.
    I was thinking of renaming the sheets to something simpler but Im fine in keeping them as is, 20 first char.
    Last edited by Kimpan; 10-11-2016 at 12:24 PM.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    That's even better, if its always the first 20 characters and we don't have to search for the " - " then it shouldn't be too hard.

    The macro basically goes inside the data workbook for exporting. When run:

    1) Uses a specific known working folder
    2) Opens each file in that folder one at a time
    3) For each sheet in the opened file, takes the sheet name and applies a filter to the output data for matching rows in column A
    4) If any rows match, copy all of them together to the bottom of the external workbook/sheet
    5) Repeat for each sheet, repeat for each workbook.

    Caveat, this does NOT insure every row is exported, it only insures that existing sheets in the external workbooks will have their matching data rows exported. It is possible for there to be output rows left that did not match to any sheet during the export routine.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Re: Update multiple workbooks with data from one workbook

    Wow thanks! thats awesome, it works good.
    One thing that needs to get sorted, the order when I have ran the macro.
    See image below, all data from 2016 is added on the bottom but in the wrong order. Can I sort this automatically and have the latest data on top? Also, all duplicates need to be deleted since I only want the latest data to be added, not all data from 2016.
    Thanks alot for the help

    Order.jpg

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    Sorting the data on the resulting output sheets is easy. What columns should be used and in what order of importance?

    Column C - Date- Descending
    only this?

    As for removing duplicates, that too is easy if we know which columns to use for determining duplicates.
    Column C only?

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    If so, just add these two lines of code:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Re: Update multiple workbooks with data from one workbook

    Awesome! thanks, it works perfectly now.
    Last edited by JBeaucaire; 10-11-2016 at 05:58 PM.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  12. #12
    Registered User
    Join Date
    10-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2016
    Posts
    7

    Re: Update multiple workbooks with data from one workbook

    Hi

    I added some formulas in rows DW and DX which I would like to get copied to the top row when rows are inserted at the top. Is it possible to add this in the macro?

    DW2=-J2
    DX2=I2-J2

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Update multiple workbooks with data from one workbook

    Hmm, maybe something like:
    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. Replies: 3
    Last Post: 07-16-2016, 08:29 PM
  2. Replies: 1
    Last Post: 07-16-2016, 11:13 AM
  3. Replies: 1
    Last Post: 07-16-2016, 11:11 AM
  4. Replies: 12
    Last Post: 06-06-2016, 11:57 AM
  5. How to automatically update data in multiple workbooks
    By Eftychia in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-09-2014, 04:48 PM
  6. Update master workbook data from separate workbooks
    By Deamo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2010, 02:32 AM
  7. Replies: 2
    Last Post: 05-22-2007, 07:15 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