+ Reply to Thread
Results 1 to 13 of 13

Create summary of worksheet data in new worksheet

  1. #1
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Create summary of worksheet data in new worksheet

    Hi,

    I would like to summarize all data rows from worksheets 1-3 (could be up to 12) on a "Summary Data" worksheet within the active workbook . Each tab could have a variable number of rows.

    The following code works to get data from a single worksheet, but the match.row causes problems when there's more than 1 worksheet. I need to a way to increment the destination row so I don't overwrite data on the summary sheet.

    Please Login or Register  to view this content.
    I'm also playing with pulling data only if the value in column C is "Delay". This code works most of the time, but it doesn't seem to copy all of the rows that say "delay" , not sure why...

    Please Login or Register  to view this content.
    Can the code be set up to copy data from a random number of worksheets into one summary worksheet, auto increment the rows for subsequent sheets, and skip blanks rows on the source sheets?

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny_XL,

    Perhaps the following code may do the task for you:-


    Please Login or Register  to view this content.
    It filters Column C in all sheets for the criteria "Delay" and transfers the relevant row of data to the Master sheet. Add as many sheets as you like and the code will cover them all.

    I've attached my test work book for you to peruse. Click on the "Consolidate" button to see it work. You may have to change the "H" in the above code to whatever your last column is.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    Wow, this solution works perfectly, and is such an efficient use of code! You have saved me a lot of effort!

    Thanks so much!

  4. #4
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny_XL,

    You're welcome. Glad that I was able to help.

    Cheerio,
    vcoolio.

  5. #5
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    Hi VCOOLIO,

    Your code seems to work flawlessly in your sample workbook, but when I use it in my actual spreadsheet, i run into an issue and i'm not quite sure why. I have made various subtle changes to your code, but I made those changes in your attached excel file, and I had no problem.

    The issue i'm having is that the value in Col. A of each worksheet is a formula (A2 pulls a date from another cell (e.g., M1) if B2 is not blank). Nothing fancy.

    On your master sheet, the value in A2 is returned as text. In my spreadsheet master, the value in A2 contains the formula, and because M1 is not the same on my summary sheet, the date is incorrect.

    I don't know why its pulling over the formula in my version, while in yours it's pulling the value of that formula. When i paste my code into your spreadsheet (and change the cell references as required), your spreadsheet still works.

    My code is here. Changes are offset, introducing a lookup based on user input, and changing cell reference (col. C is now J, and the data is in col A-L)

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny,

    My sample doesn't have formulae but your work book does so we need to make a subtle change to the code just so that values only are transferred.
    Hence, change the following part of the code:-

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    In the part of the code where you are excluding the Master, Admin and Template sheets, you may want to change the Or to And. Or is used more as an option.

    Also, I notice that the data transfer starts from row 5 so I assume that your headings are in row 4. If so, place the filter on J4 not J1. and then change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Test it all in a copy of your work book first.

    I hope that this helps.

    Cheerio,
    vcoolio.

  7. #7
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    Hi Vcoolio, and anyone else,
    Finally have a chance to get back to this. However, i'm still seeing weird things.

    1) The "TransferToMaster" macro runs, but i've notices in a few cases some data is not copied. It might be related to having blanks in the source data table, because if I add any text in the "Other comments" column for those cells, they are copied to the master. But, it doesn't always miss blanks. (that is, sometimes there is no comment in the "other comments" column, but the sata is still copied.

    For example, in the attached file, when i run a search for "Complete", it misses the data from:
    April 2016, row 33 (ie, item 9c)
    April 2016, row 36 (ie, item 10)
    May 2016, row 14 (ie, item 8)

    If i run searching for "No Action Required), it misses the one row:
    March 2016, row 13 (Item 9)

    I could always make sure there are no blanks (assuming that would work), but why is it doing this?

    2) If there is no matching field found in the source data of a given worksheet (ie, searching for "complete", but there are no matches in a worksheet), the macro pastes in the header row. No idea why. It's not a big deal as it can be deleted, but can this be prevented? I don't know why it would even look in this field.

    3) If there happen to be no status at all on a given page, it pastes row 1 into the master sheet. This is unlikely to occur in real life, but what's going on? The macro should never look in row 1 for anything!

    The source code is here, and the spreadsheet set up as per my data/needs is attached (stripped of data, but it responds the same way as my file with real data in the same places...

    Thanks for any help!

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    having trouble attaching the spreadsheet...will try again.
    Attached Files Attached Files
    Last edited by Jonny_XL; 08-11-2016 at 02:43 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny,

    I haven't had a close look at it yet but try the following take on autofilter:-

    Please Login or Register  to view this content.
    Let me know how it goes.

    Cheerio,
    vcoolio.

  10. #10
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    Nice, this seems to do the job! I'm going to test it out more thoroughly, but everything seems to work right now.

    I decided i wanted to paste both values and formats, so I changed to include both these lines in place of just xlPasteValues:
    Please Login or Register  to view this content.
    seems to work, although there's probably a more efficient way...
    Last edited by Jonny_XL; 08-12-2016 at 04:57 PM.

  11. #11
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny,

    You could change this part:-


    Please Login or Register  to view this content.
    to


    Please Login or Register  to view this content.
    Cheerio,
    vcoolio.

  12. #12
    Registered User
    Join Date
    09-14-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    18

    Re: Create summary of worksheet data in new worksheet

    Thanks for all the help!

  13. #13
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Create summary of worksheet data in new worksheet

    Hello Jonny,

    You're welcome. Glad that I could help.

    Good luck!

    Cheerio,
    vcoolio.

+ 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 Code to Create One Summary worksheet of many worksheets in workbook
    By brandnew22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2014, 06:58 PM
  2. Replies: 2
    Last Post: 06-21-2013, 07:23 AM
  3. Replies: 1
    Last Post: 01-16-2013, 01:34 PM
  4. create automatic summary worksheet for Po order form
    By yohan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2010, 03:01 PM
  5. How to create summary form using worksheet data
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2009, 09:00 PM
  6. summary data sheet from worksheet to worksheet
    By KKay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-21-2006, 05:45 AM
  7. Replies: 2
    Last Post: 02-20-2006, 04:55 PM

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