+ Reply to Thread
Results 1 to 9 of 9

Master workbook to pull data from second workbook into seperate sheet

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Master workbook to pull data from second workbook into seperate sheet

    Hi,

    I have a workbook (master) with a Macro Button that I'd like to press to open the 'file open dialogue box' ,allow me to select another workbook (temp), and copy the contents of "temp:sheet1" into "master:sheet2'".

    I can get this to work by recording the macro, however it doesn't allow me to change which file I open. I'd like the option to select.

    Any help would be much appreciated.

    Dave

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Master workbook to pull data from second workbook into seperate sheet

    Hi, try this
    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Master workbook to pull data from second workbook into seperate sheet

    Thanks for the quick response. I pasted in the code you offered and I get a 'run time error' at this point:

    Please Login or Register  to view this content.

    Do i need to alter the names of the sheets in the code to match what mine are written,

    i.e. sheet1


    thanks
    Dave

  4. #4
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Master workbook to pull data from second workbook into seperate sheet

    I should have tried it before posting back, got it to work. Thanks again for the swift response.

  5. #5
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Master workbook to pull data from second workbook into seperate sheet

    Hello Djm,

    Can you please attach the excel workbook with the solution. That will very helpful.

    Thank you

  6. #6
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Master workbook to pull data from second workbook into seperate sheet

    Hi djm601,
    yes you do need to change that part to your sheet names, ranges etc - that was just an example.
    Glad it is all working.

  7. #7
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Master workbook to pull data from second workbook into seperate sheet

    Book1.xlsb

    Here is the workbook for those of you who are interested.

    Alter the ranges in the following line of VBA code to match your requirements:

    Please Login or Register  to view this content.
    Regards,

    Dave

  8. #8
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Master workbook to pull data from second workbook into seperate sheet

    Hello Djm,

    How does your workbook works? I only see a button. Can you please explain. Thank you!

  9. #9
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Master workbook to pull data from second workbook into seperate sheet

    Hi Naja,

    I was after a workbook with a macro that when pressed would prompt you for another workbook and copy the data from Sheet1 in that workbook and paste it into sheet2 on the master workbook. Thus eliminating the need to open two workbooks, highlight the data and paste it in.
    Whilst the workbook is open, press Alt F11, find this line of code:

    Please Login or Register  to view this content.
    alter the code to match the names of your sheets and the range. Currently this code will only copy whatever is written cell A1 from sheet1 wkbook2 into sheet2 wkbook1.

    Hope this helps.

    Any problems, feel free to message

+ 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