+ Reply to Thread
Results 1 to 22 of 22

copy active workbooks to a paste to closed consolidation workbook

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    copy active workbooks to a paste to closed consolidation workbook

    Hi All

    I have several purchase orders workbook daily, need to do some data entry once completed save it , copy the actual range to a consolidation summary workbook in a specified directory.

    I am looking a vba code for the po sheet in the workbook, copy the actual range on that sheet only with formats and values only and paste it in the closed workbook consolidation summary workbook.

    However the vba code should be modulable on the headers as there are other purchase orders with more headers and some with less headers and consolidation summary directory differs

    Note the po files have other sheets.

    The headers are same for for po workbook and consolidation workbook found C:\\SUMMARY \consolidation summary.xlsx

    Any assistance would be grateful as this will save me a lot of time
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi JEAN

    Sending data to closed workbook is,in my opinion, possible with some ADODB connection.Have you google and tried something like that?
    Teach me Excel VBA

  3. #3
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi Imran

    Have google for this but indeed my knowledge in coding language is low.Trying to learn with what I do at work .

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi JEAN1972

    Please explain the details of Headers again...
    However the vba code should be modulable on the headers
    As per your samples, all you are doing is copying information from Po1 & Po2 to Summary sheet which has the same headers...Up to Header 20
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi Sinetek

    I will upload amended files for ease of undestanding in a few minutes

  6. #6
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    See attached amended files.

    I have 25 to 30 purchase orders daily .

    With po1 I had some data entry to be done then save I save the po1 but need to copy the current region by opening manually consolidation summary file found to C:\\SUMMARY \consolidation summary.xlsx
    paste it under next emptyrow with their respective headers.

    So if data in consolidation sheet is at row 1515 then po1 is copied to row 1516 under their respective headers which are same format as po1 and po and so on .


    Then same is done po2 , data entry save the file and paste po 2 data in consolidation summary sheet.

    and the process goes on po3,po 4 etc etc.

    So I am looking a vba code that copies the active sheet as per attached to consolidation summary sheet without opening it

    However code need to auto fit in consolidation summary as data varies per column

    modulable headers means that certain purchase orders have same format but it may end e'g header 1 to header 7

    other header1 to header 22 etc but they are saved in same directory as C:\\SUMMARY \consolidation summary AB.XLSX, OTHER
    C:\\SUMMARY \consolidation summary ABDE.XLSX and so on.

    So I need to change manually the code headers range, the path and consolidation file name as explained above


    Hopes it helps
    Attached Files Attached Files
    Last edited by JEAN1972; 05-01-2017 at 05:25 AM.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: copy active workbooks to a paste to closed consolidation workbook

    Nope...Sorry I still don't get it..
    .However code need to auto fit in consolidation summary
    Consolidation is going to always have one header......Header values depends on headers per PO opened.....
    So basically what you are doing is copying the active range to Summary below current etc etc etc even if there is just 7 headers....the balance will be blank?
    My apologies...Perhaps someone else can get the gist of your requirement....
    Last edited by sintek; 05-01-2017 at 07:05 AM.

  8. #8
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Perphaps my explanation was confusing .

    as per post 6 with the amended examples, Is it possible to a have sample as per post 6 amended files .

    That is with sample files poa1 copy the active sheet to the closed file c:\\ summary\ consolidatea summary.xlsx .only

    can you have a try and advise

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: copy active workbooks to a paste to closed consolidation workbook

    JEAN1972,

    Are the headers of each file looks always the same?
    If so it should be very easy.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: copy active workbooks to a paste to closed consolidation workbook

    as per post 6 with the amended examples, Is it possible to a have sample as per post 6 amended files .
    This is as I explained in post4 & post7.All you are doing is opening the purchase orders, copying all the info to a summary sheet below other info....
    whether or not it has 2 headers or 20.....the information will still be copied in column order....

  11. #11
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi Jindon

    The headers always the same as per amended sample files po1a, po2b and summary consolidatesummary.xlsx.

    NOTE for po1A.xlsx column V add header 21 I missed that sorry

    all worksheet will have same headers .

    Do note take into account my modulable header request as it is causing confusion.

    Just look at the sample files provided that is active sheet po1a.xls copy activesheet to closed workbook c:\\ summary\ consolidatea summary.xlsx .only
    There is only one sheet in the closed workbook.

    Hope it clearer now.

    Advise if you need further clarifcation

  12. #12
    Forum Contributor
    Join Date
    11-01-2016
    Location
    Prague
    MS-Off Ver
    2013
    Posts
    121

    Re: copy active workbooks to a paste to closed consolidation workbook

    I had a same issue. And just a few minutes ago JOHN H. DAVIS helped me to fix my code.

    Try this code exactly. Hope it works


    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi Sintek

    There are 21 headers I just missed one on po1A .xlsx otherwise All will have same orders .

    All are copied in same column order

    Advise if u need further clarifcation

  14. #14
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi orhanceliloglu

    I have a try and advise

  15. #15
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: copy active workbooks to a paste to closed consolidation workbook

    Quote Originally Posted by orhanceliloglu View Post
    Try this code exactly. Hope it works
    I think there is a difference between your query and that of JEAN's

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: copy active workbooks to a paste to closed consolidation workbook

    JEAN1972
    To po1A or 2A and if this is how you wanted, you could save the code onto PERSONAL.XLSB, so that you could run from each file.
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    11-01-2016
    Location
    Prague
    MS-Off Ver
    2013
    Posts
    121

    Re: copy active workbooks to a paste to closed consolidation workbook

    Quote Originally Posted by ImranBhatti View Post
    I think there is a difference between your query and that of JEAN's
    Maybe I couldnt understand JEAN's query. I am attaching my excel to Jean's review.
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    HI orhanceliloglu

    Try code , your approach is good but it copies and create a Master in the same workbook

    So that po1A.xlsx , I make my data entry and then activate the macro to copy the active sheet range to the closed workbook which is found on directory on C:\\ summary consolidatea.xlsx.

    The summary file has already their headers.

    Then same action opened po1B.XLSX and copy active sheet on which is found on directory on C:\\ summary consolidatea.xlsx.

    A little tweak need to be done to copy to the closed workbook on on C:\\ summary consolidatea.xlsx.c without overwriting existing data in consolidation workbook.
    Attached Files Attached Files

  19. #19
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: copy active workbooks to a paste to closed consolidation workbook

    Hi JEAN1972

    Have a look at this code....what it does is as follows:
    Lets say that all your purchase orders are in a folder called PO Folder.
    It loops through, opens PO1, copies the usedrange less headers to Summary
    then goes to PO2 and copies the used range below the other etc etc etc.
    Put this code in a sample workbook and test it....
    Please Login or Register  to view this content.
    Last edited by sintek; 05-01-2017 at 10:45 AM.

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: copy active workbooks to a paste to closed consolidation workbook

    JEAN1972

    You are welcome and thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  21. #21
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: copy active workbooks to a paste to closed consolidation workbook

    Thank you all for assistance and time dedicated to solve this issue

  22. #22
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: copy active workbooks to a paste to closed consolidation workbook

    Pleasure...thanks for rep points

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2017, 02:34 PM
  2. need vba to copy sheets from closed workbook and paste into all closed wb's
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2016, 01:25 PM
  3. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  4. Run Macro in closed workbook and copy specific coloumn in active workbook
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2013, 03:43 AM
  5. Copying rows from multiple closed workbooks to active workbook
    By onbeillp111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2013, 11:19 AM
  6. [SOLVED] Copying cells from multiple closed workbooks to active workbook
    By Anonym216 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2013, 07:53 AM
  7. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM

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