+ Reply to Thread
Results 1 to 8 of 8

feed mutiple files from a master source

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    46

    feed mutiple files from a master source

    I have a masterfile (Ecompiled) and would like to feed data from it into two or three other files. (For the purpose of this lets just say the two other files are "Items" & "Customer" ). I have attached a simpler sample of my files. I know there must be a way to do this with vba but i dont know too much about vba and I am hoping someone out there would be able to help. Thanks in advance of your help
    Attached Files Attached Files
    Last edited by CharlieZangel; 06-15-2012 at 10:03 AM. Reason: adding attachment

  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: feed mutiple files from a master source

    This is not dynamic (realtime?), right? So you just need a macro to "update" the Items and the Customer files doing a straight copy/paste?

    Assuming:
    1) The eCompiled sheet always has all the data that should ever appear in the other workbooks
    2) Each time the update occurs, the update replaces all the data in the other workbooks with the data from the eCompiled wb
    3) All 3 workbooks reside in the same folder on the server
    4) The Items and Customer files may or may not be open already when the macro runs

    Try this:

    Please Login or Register  to view this content.

    This macro will open the files if they are not open already, leave them open if they were open.
    Attached Files Attached Files
    _________________
    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
    06-15-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: feed mutiple files from a master source

    Thanks JBeaucaire for your quick response, I really appreciate it.

    I tried that on the sample file I sent you but it didnt work, It cleared all the content in the two other files.

    i didnt want to trouble anyone with the actual file was why i used a simpler one, since the actual file in my opinion is a bit cumbersome but here are my actual files, master file (DATA RECORD), and feed files (CONTROLRECORD, INSUREDRECORD and POLICYRECORD)

    As you will see all the information that will be needed in the feed files are all in the master file, the feed files will usually not be open, but I like the fact that you coded it to be able to run with or without them being opened.

    Your assumptions are all correct

    Assuming:
    1) The eCompiled sheet always has all the data that should ever appear in the other workbooks YES
    2) Each time the update occurs, the update replaces all the data in the other workbooks with the data from the eCompiled wb YES
    3) All 3 workbooks reside in the same folder on the server YES
    4) The Items and Customer files may or may not be open already when the macro runs YES
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-15-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: feed mutiple files from a master source

    Hey JBeaucaire, I actually was able to get this to work must have made a mistake the first time. One thing though, when i run the macro, if all workbooks are opened I am able to populate the workbooks from the master, if they are not opened, the only one that is populated is the first file refernced in the macro. My file is attached
    Attached Files Attached Files

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

    Re: feed mutiple files from a master source

    1) One of the edits you made removed some of the flexibility of the original macro. If all 4 files reside in the same folder together, the fPATH variable allows you to open the books that are closed without having to hardcode the path into the macro like you did. Change your:
    Please Login or Register  to view this content.
    ...to
    Please Login or Register  to view this content.

    2) After making the edits above, make sure all 4 files are in the same folder and try again. The code is the same for all 3 workbooks except for the columns you're copying

    3) In the original example, we included a key set of beginning columns in both copy commands. The sample files in post #3 lead me to believe you may want more than just the adjacent columns I now see in the macro. Look at my original example again if you want to include, perhaps, column A along with H:P.

  6. #6
    Registered User
    Join Date
    06-15-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: feed mutiple files from a master source

    Thanks for your expert help, I really appreciate this. I have made the chnges above and all the files are located in the same folder but yet only the first file referenced in the Macro is populated when I run the macro.
    Attached Files Attached Files

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

    Re: feed mutiple files from a master source

    Hmm, try this:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-15-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: feed mutiple files from a master source

    Thanks al lot! It worked! Thanks a million!

  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: feed mutiple files from a master source

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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