+ Reply to Thread
Results 1 to 9 of 9

Copy content of one workbook to another workbook without opening both the file

  1. #1
    Registered User
    Join Date
    09-01-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Copy content of one workbook to another workbook without opening both the file

    Hello All,

    I am looking for a help to resolve the below scenario using macros:

    I have a file called "list.xls" with the list of spreadsheet names e.g AcctA.xls, AcctB.xls, AcctC.xls, AcctD.xls,etc.,(spreadsheet name will be unique) in the column C. All these listed spreadsheets are already available in directory. I have another spreadsheet named "Printing list.xls" which is acting as master. Now, i would like to copy the content of the spreadsheet AcctA.xls, Acct B.xls, etc, which i ever i select using input box and paste it in the Printing list.xls. I would like to copy Column A, D, E and F based on the filter applied to column F has "Print" and paste it into Column D of Printing.xls

    In simple words, I want to copy and paste the details without opening any spreadsheets except the list.xls which has the list of all these spreadsheets.

    I hope i explained in detail which may helps to understand my requirements easily.

    Thanks in advance. Early help would be much appreciated...

    Mansoor

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy content of one workbook to another workbook without opening both the file

    Hi Mansoor_naz2002,
    to transfer the data you have to know the full workbook paths, names and open the workbooks.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    09-01-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Copy content of one workbook to another workbook without opening both the file

    Hello Pike,

    I could able to work out partially using ado instead of opening and closing each workbook. While using getdata i could able to get and paste the data in the master file "List.xls" whereas i would like to change the destination.

    GetData ThisWorkbook.Path & "\AcctA.xls", "AcctA", _
    "E13:H17", Sheets("Sheet1").Range("B8"), True, False

    any suggestion on changing the highlighted destination file to "Printing.xls" which is available in different path.

    Also, i am able to transfer entire details from the acctA.xls instead i require Column A, D, E and F from acctA.xls to printing.xls...

    Looking forward the help.....

    Mansoor

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy content of one workbook to another workbook without opening both the file

    no, not really
    what the complete code??

    can you use

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-01-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Copy content of one workbook to another workbook without opening both the file

    Please Login or Register  to view this content.
    Last edited by pike; 02-12-2011 at 11:22 PM. Reason: code tags

  6. #6
    Registered User
    Join Date
    09-01-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Copy content of one workbook to another workbook without opening both the file

    Thanks for your time Pike, above is the code i have modified for my requirement. but could not able to change the destination file. Also, is there any way that i can give the fields to be selected using SELECT query. because from the above codes, output shows all the COLUMNS where the ROWS meet WHERE clause criteria. I would like to select Col A, D , E & F.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy content of one workbook to another workbook without opening both the file

    Hi Mansoor_naz2002,
    can you please add code tags and your previous post

  8. #8
    Registered User
    Join Date
    09-01-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Copy content of one workbook to another workbook without opening both the file

    Hello Pike, here is the tagged code, from the below code i would like to select column A, D, E & F from source file, and paste in the different destination file name.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy content of one workbook to another workbook without opening both the file

    Hi ,Mansoor_naz2002

    still looking with "INSERT INTO" but cant get the columns
    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)

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