+ Reply to Thread
Results 1 to 20 of 20

Bringing data from mulitple worksheets to a master sheet

  1. #1
    Registered User
    Join Date
    11-22-2007
    Posts
    60

    Bringing data from mulitple worksheets to a master sheet

    Each salesman has an enquiry log / hot prospect sheet that they are responsible for.

    At present at the end of the month our receptionist has to consolidate this information manually onto a master sheet.

    I would like to create an automatic master sheet that auto updates each time it is opened.

    It has to read data from about 13 work books each with varting amounts of date. All works books are formatted identically (or they will be)

    I would like the date to be sorted by date.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Will the workbooks be in one Directory?

    Attach an example of the workbook to copy.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    All the files will be stored in the same directory on our server.

    I am unable to attach the spread sheet - I keep getting an error (I have tried .xls & .zip)

    Basicaly row 1 is a header
    2 down will contain consistent data

    Coloumns A-Q are filled -

    Status, order date, customer, country, area, sales man, machine, quote price, etc.

    It is just data - Each spreadsheet will have no forumla just manually typed info.

    If you still need an example can you suggest a free file sharing website I can use?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You won't need to copy the header row, but what about the "consistent data"?

  5. #5
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Yeah don't need the header

    By consistent - I mean there will be no blank lines. until the end of the data.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You'll have to test this. The code first asks the user to select a Folder containing the files. Then copies the data from each workbook to the one containing the code.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    I just get a "no workbooks found" error.


    Other xls sheets will also be present in the folder that do not relate to this.

    I would prefer to hard code each file location into the script and have little or no user intervension - the spread sheet is opened - It gets all the data from the other spreadsheets - It sorts that data it shows the data.

    I understand this will need chaging when new salesman begin or someone leaves but I would prefer it that way
    Last edited by kgkev; 06-10-2008 at 10:23 AM.

  8. #8
    Registered User
    Join Date
    05-03-2008
    Posts
    57
    someone sent me this code to accomplish a similar goal. you may find it useful:

    assume 3 workbooks called bill, mary and arthur. each has a sheet called "1" [saves my typing!] and each has columns called Person Account Date and Value.

    In a fourth workbook use >data >import external data > new database query. select Excel files as the data source. Click on the SQL button and type..

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-08-2008
    Posts
    36
    Hi royUK,
    I open your file, but there don't seems to be any place for me to select files.


    Hi durandal05,
    Where do I find this
    Click on the SQL button and type..
    I'm facing the same problem as kgkev. Attached is the objective that I want to acheieve. Combine book1 and book2 to from combined book.
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by jieyi
    Hi royUK,
    I open your file, but there don't seems to be any place for me to select files.


    Hi durandal05,
    Where do I find this


    I'm facing the same problem as kgkev. Attached is the objective that I want to acheieve. Combine book1 and book2 to from combined book.
    If you run the macro Get_Data_From_All you are prompted to select a Folder containing the files.

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by kgkev
    I just get a "no workbooks found" error.


    Other xls sheets will also be present in the folder that do not relate to this.

    I would prefer to hard code each file location into the script and have little or no user intervension - the spread sheet is opened - It gets all the data from the other spreadsheets - It sorts that data it shows the data.

    I understand this will need chaging when new salesman begin or someone leaves but I would prefer it that way
    If the folder you select contains excel files they will be opened and if they contain data it will be copied.

    To hard code the path you only need this macro

    Please Login or Register  to view this content.
    Last edited by royUK; 06-23-2008 at 12:31 PM.

  12. #12
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Nearly there now I think - But it only gets the data from one workbook.

    I have cheated and stored 3 sample enquiry logs in C:\myfolder

    I then run the macro from MASTERSHEET on my desktop.


    the problem I can see is the folder will contain excel files that do not contain the correct data and should not be carried across - As the file location is decided by our CRM it is not possible to change.

  13. #13
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    I think rather than only copying one set of data it is over lapping each set rather than starting at the bottom of the data.

    Also how do I make this script run as soon as the Spreadsheet is opened.

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It would be simplest to agree to have a subdirectory to store these workbooks.
    Quote Originally Posted by kgkev
    I think rather than only copying one set of data it is over lapping each set rather than starting at the bottom of the data..
    The code should copy the data to the next empty row

    Quote Originally Posted by kgkev
    Also how do I make this script run as soon as the Spreadsheet is opened.
    You can trigger the macro by using the WorkBook_Open event, this will run each time the workbook is opened. Are you sure you want to do it this way? I would have a button to trigger it or at least a message to ask if the user wants to complete the action like this.

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    I cannot specify a directory - Half of the sales team are out of the office and use a remote update facility in our CRM. They take an offline view of all the data and when they have access to the internet they update the database - this stores all documents in the same place.

    The script definatly over rights the previous set of data.

    ie

    It read Sample 1 and inserts the data - Then it reads sample 2 and inserts the date over the top of sample 1. Sample 3 then overright the previous set of data so all I am left with is a copy of Sample 3 but with 2 headers.

  16. #16
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    I still haven't managed to get this to work.

  17. #17
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Also still require some help with this one if possible.

  18. #18
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    Hi All,

    i'm trying to achieve a similar thing as well, but have the same issue with this code not bringing back the data from all the sheets in the specified folder. The files that are not being copied back seem to have more than one worksheet tab in them....could this be casuing the issue??

  19. #19
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    My problem is not just that it doesn't bring back the data - I also want it to only bring back data from specified workbooks.

    I will have non relevant workbooks in the same folder.

  20. #20
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by kgkev
    I cannot specify a directory - Half of the sales team are out of the office and use a remote update facility in our CRM. They take an offline view of all the data and when they have access to the internet they update the database - this stores all documents in the same place.

    The script definatly over rights the previous set of data.

    ie

    It read Sample 1 and inserts the data - Then it reads sample 2 and inserts the date over the top of sample 1. Sample 3 then overright the previous set of data so all I am left with is a copy of Sample 3 but with 2 headers.
    The code should be writing to the next empty row in the destination sheet with this line

    Please Login or Register  to view this content.
    having mixed workbooks will be a problem unless you have some method in the names to exclude the ones that you don't want.

+ 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