+ Reply to Thread
Results 1 to 20 of 20

Compile Several Worksheets of Data based on Month

  1. #1
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Compile Several Worksheets of Data based on Month

    I have a workbook that has several sheets of data...all same columns, different number of rows on each. I need to compile data from all sheets based on the month the data closed. I have attached an example worksheet. 30 day would be gathering data from current month, 60 days would be future month (i.e. October), and the same with 90 day (November).
    I know I can do a v lookup to return the data in the columns however I would have to copy the "month" column to column A and because of another macro I have in the sheet, when the employee adds a new row, it doesn't copy the formula of the previous row which would bring the data over from the "month" column.
    Is there another way to gather this data?
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    So looking at your workbook, i have the following questions:

    1. You mean to say that the data from the Scott, Tim and Paul tabs needs to be segregated into the 3 tabs - 30 day, 60 day and 90 day based on the month when it was closed?

    2. Only the rows that have status as "Closed" should be copied or all rows?

  3. #3
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    All data rows from Scott, Tim and Paul needs to pull into the three tabs respectively depending on month it was closed - that is correct. All data should be copied, not just the rows that show 'closed'.

    Thanks

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    Will you always have 3 separate tabs for the people - Scott, Tim and Paul? Will there be more such tabs?

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    Cynd301,

    I have been trying to create the code for you. Its pretty simple but i have run into problems because the Month field shows "Sep" or "Oct". (I even raised a separate thread to get help from others). Is it possible to put in the month number (like 9 for sep or 10 for oct) in the column? It will really simply the code further and i will have a ready solution for you.
    Last edited by arlu1201; 10-04-2011 at 07:31 AM.

  6. #6
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    There will be more tabs as people are added. We can definitely change the month to a number, that will be easy. Thank you so much for your help.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    I have changed the month to a number and the code is as below:

    Please Login or Register  to view this content.
    I found some entries for September which were not fitting anywhere so i moved them to the "Extra" Tab. If any rows don't meet the criteria, they will go there. That way you can identify if any data is out of place.

  8. #8
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    Thanks so much for your help. I pasted the code in the worksheets and when I run the macro it gives me a "400" error? I am not sure what that means.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    You need to ensure that you paste the code in the Module. Also ensure that you have the "Extra" tab present.

    Also, any hidden worksheet in your workbook?

  10. #10
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    Thanks. I will make sure I paste it into the MOdule. There is one hidden worksheet for some dropdown menus we have. Will that make a difference?

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    It shouldnt. If it does, let me know what error you get.

  12. #12
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    Still getting the "400" error. I wonder if it is because there is too much data. In my actual spreadsheet there are 8 sheets that will feed the 30 / 60 / 90 day summary tabs. I did change the sheet count in the code to match 8 sheets however I am still getting the error. I pasted it into the module on the sheet however it still gives me the error.

  13. #13
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    You should paste it in an independent module. Right click on Microsoft Excel Objects in the Visual Basic Editor and click on Insert -> Module.

    I did some research online and found that this error happens when there is a protected range that is being accessed. Do you have any protected range?
    Last edited by arlu1201; 10-10-2011 at 09:41 AM.

  14. #14
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    Thanks...that worked. One last question - it is bringing over the "total" rows from all 8 sheets. Is there a line we could add that if the first cell on the row = total, not to include that row?

    This is wonderful - I cannot tell you how much I appreciate your help with this.

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    Try this out and let me know :

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    Thanks. That worked with a few exceptions - it now only pulls data into the "extra" tab - the 30 day/60 day/90 day doesn't get any data. It is pulling everything over but continues to pull over the total column from 3 sheets - haven't figured out which sheets yet.

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    Is the total field just below the data or is there a row in between?

  18. #18
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    Please post the latest sample workbook with the 8 sheets and i can try something out for you.

  19. #19
    Registered User
    Join Date
    08-26-2011
    Location
    Birmingham AL
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile Several Worksheets of Data based on Month

    There is a row in between the total row and the last row of data. I have attached the updated sample workbook with the two macros included - one in the module and one in the workbook (that one adds the extra row between data and total row on each sheet).
    Thank you so much for your help with this.
    Attached Files Attached Files

  20. #20
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile Several Worksheets of Data based on Month

    I have checked the macro. It works now. The numbers stored in the Close month column were stored as text so it was not considering it. You need to format it as numbers. Then it works.

    Also i have observed that you have some other code in the "This Workbook" section. My code doesnt get affected, but i have observed that it does go to that code and then come back. This is just for your information.

    I have just added a few extra lines - here is the updated code -

    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