+ Reply to Thread
Results 1 to 9 of 9

How to copy values from one OPEN workbook (with variable file name) to another

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2011 Mac
    Posts
    7

    Question How to copy values from one OPEN workbook (with variable file name) to another

    Hello there :-)

    Every month I receive a batch of new files with names such as Analysis_Report_0001, 0002, 0003 etc. The Analysis_Report string is always there but the numbers are changing - you get the idea.

    Then I have a file Analysis Summary where I need to input certain values from the Analysis_Report files.

    Here's the code that works (I have both files already open and the macro is in the Analysis Summary file).

    Please Login or Register  to view this content.
    What I need to do is to have a macro nested in the Analysis Summary file, that would activate any OPEN workbook that contains the "Analysis_Report" string in its file name, copy the selected range, and paste values to the first empty cell in the column C.

    Now, I don't need the macro to open the Analysis Report file, as I already have it open, and I need to do without references to C: stuff - the path would change every month anyway.

    I've spent the last two days comming out with a solution, and I'm going gray by now :-)

    Any help will be much appreciated.
    Last edited by Kitko; 01-25-2013 at 08:50 AM.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Please wrap the code in your post with the CODE tags. Select your code and click on the # button.
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2011 Mac
    Posts
    7

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Thanks, done, won't happen again :-)

  4. #4
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Try this

    Please Login or Register  to view this content.

  5. #5
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Try this

    Please Login or Register  to view this content.
    Last edited by OllieB; 01-25-2013 at 09:02 AM.

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    @Kitko,

    Please test with the code from post #5, there were some typing errors which I have corrected.

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Maybe this

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Maybe:

    Please Login or Register  to view this content.
    This gives the Workbook which contains Analysis_Report a variable (Abk) for you to work with as long as you don't have two Analysis_Reports open at the same time.

  9. #9
    Registered User
    Join Date
    01-25-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2011 Mac
    Posts
    7

    Re: How to copy values from one OPEN workbook (with variable file name) to another

    Quote Originally Posted by OllieB View Post
    @Kitko,

    Please test with the code from post #5, there were some typing errors which I have corrected.
    Thanx OllieB, that worked like a charm!!!

+ 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