+ Reply to Thread
Results 1 to 7 of 7

copy data from open workbook then paste data into different workbook based on user input

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    Gloucestershire
    MS-Off Ver
    Excel 2010
    Posts
    4

    copy data from open workbook then paste data into different workbook based on user input

    Hi all, I am very new to this and have searched the forums looking for an answer but can't find something that puts it all together!

    I have several workbooks that hold a column of data (all the workbooks have the data in the same column) and I want to be able to include a button on each workbook that when clicked, copies this data to another workbook (the master). The trick is that I want the user to be able to choose where the data will be copied to in the 'master' workbook. Ideally I would like the user to have a drop down menu of 'headers' they can choose which will determine the column the data will be copied to. For example the 'master' may have different countries as the headers (Italy might be column K) and if the users selects 'Italy' then the data will be copied into this column.

    I haven't included any of the patched up code I tried to pull together because although I can get parts of it to work, when I try to put those parts together I get all sorts of errors. If anyone has done this before and can help I would be very grateful!

    Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: copy data from open workbook then paste data into different workbook based on user inp

    Hi.

    Can you post a file as example?
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    Gloucestershire
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: copy data from open workbook then paste data into different workbook based on user inp

    master.xlsmItaly_data.xlsx Hi - do you mean an example of the 'master' and data excel files?

    Hopefully this should give you an idea - the master has a sheet where the data needs to be pasted for each country - I want to use the same 'data' sheet for each country so when the macro is run, the user can select which country the data should be copied to - thanks
    Last edited by Hugard; 01-29-2013 at 05:56 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: copy data from open workbook then paste data into different workbook based on user inp

    Yes. The master file and the data file which is to be copied.

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    Gloucestershire
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: copy data from open workbook then paste data into different workbook based on user inp

    master.xlsm Italy_data.xlsx - Hopefully this is what you were after? Thanks

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: copy data from open workbook then paste data into different workbook based on user inp

    Hi

    Try this:

    Italy_data.xlsm

  7. #7
    Registered User
    Join Date
    01-29-2013
    Location
    Gloucestershire
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: copy data from open workbook then paste data into different workbook based on user inp

    Hi - when I run it I get an error saying 'runtime error 9 - subscript out of range' at this line: Workbooks("master").Activate

    I tried to run this with the master workbook open and with it closed (I assume it should be open?) but get the same error - any ideas?

    This error happens once I have chosen the country and pressed the copy button

    Thanks

+ 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