+ Reply to Thread
Results 1 to 14 of 14

Collecting Data from multiple worksheets

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Collecting Data from multiple worksheets

    I have a workbook that has worksheets labled from the last 2 years. I want to create a macro that will collect data from select worksheets. The "range" of data from each worksheet will vary, but let's say I wanted to collect B2:E15 on each worksheet (this will collect some "blank" rows from some of the worksheets). Example worksheet names are "Jan" "Feb" and "March". I want the data to collect in rows...each new worksheet data to "paste" below the previous months data. I have seen several variations of what I am looking for, but not exactly what I am looking for. I have been able to modify a macro, but it doesn't do exactly what I am looking for. Any help would be appreciated.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Collecting Data from multiple worksheets

    show us a excel file without confidentional information and a few sheets with data in it.

    please also add the desired (expected) result.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Collecting Data from multiple worksheets

    I have gone ahead and attached part of my report. Here is what I am looking at doing:

    Tabs I want data collected from: Mar 13, Apr 13, May 13, June 13. The data I want collected from each tab is going to have the same cells; however, some may have more rows. So there may be "empty" cells that are collected. The columns from these worksheets that I want information collected from are J, M, O and P all the way to row 30 as that is the most rows I would ever have information in. **These cells are calculated from formulas. I want the information from these cells "pasted special" into the summary tab such that the information from Mar 13 is the first collection of information and "pasted" below this information is the Apr 13 information and pasted below this information is the May 13, etc. etc. etc. with empty cells being written over since the number of rows with information will vary from worksheet to worksheet. So in the end, I have a long string of data on the summary page from select worksheets within my workbook.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Collecting Data from multiple worksheets

    With the code below you can consolidate the data.

    Ather that you can analyze the data e.g. with an pivot table.

    See the attached file.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Collecting Data from multiple worksheets

    Thank you - the code is beautiful. It DOES work in that it brings information together; however, it is not collecting the information I need. I went through the code and changed the line

    .Range("A1:I1").Value = Array("sheet", "Date Filed", "Status", "Owner", "Ack letter", "date Days", "Compliance (yes or no)", "Resolution letter date", "Compliance (yes or no)")

    to this:

    .Range("M1:S1").Value = Array("sheet", "Responsible Owner", "Name/yes&NA (I)", "Number of Cases", "Acknowledgment Compliance", "Name/yes&NA (K)", "Resolution Compliance", "Month")

    Since M1:S1 is actually the data that I want complied; however, it is not working. Is there another field I should change as well in the code?

    Also - one more question, if you would be so kind: The actual workbook I will be using has worksheets from the last several years; however, I am only going to be compiling information from the most recent worksheets only (all other worksheets can be disregarded). Is there a way in the code for me to explicitly state what worksheets I want information to be pulled from so that information is not pulled from every worksheet?

    Again, thank you so much.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Collecting Data from multiple worksheets

    Change

    Please Login or Register  to view this content.
    In


    Please Login or Register  to view this content.
    What are the name of the sheets you want to be pulled.

  7. #7
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Collecting Data from multiple worksheets

    The names will just be the months of this year so Jan13, Feb13, Mar13, Apr13, May13, June13, July13, Aug13, Sep13, Oct13, Nov13, Dec13.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Collecting Data from multiple worksheets

    Try this one on a copy of your file.

    Please reply your comments.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Collecting Data from multiple worksheets

    Hi,

    I went ahead and tried running the modified macro in my acctual report along with the adjustment I made to the range line so that it would pull the data from columns M to S; however, I just keep getting an error and nothing is happening now. I played around with the macro and tried it several different times with several different variations to get the data I need, but nothing seems to work. Maybe you can see what is going on...? I have attached my actual report.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Collecting Data from multiple worksheets

    Please Login or Register  to view this content.
    INTO

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    08-22-2012
    Location
    nj, us
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Collecting Data from multiple worksheets

    make sure to save the file as a macro-enabled, or the macro will not be saved

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Collecting Data from multiple worksheets

    I changed the suggestion of AB 33 (thanks for that) in your code.

    See the attached file.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Collecting Data from multiple worksheets

    Oeldere,
    It was you code.
    You did not notice you used sh instead of ws. I think if you had tested it before posting, you would have spotted the error as the code will not run beyond that line since there is no sh in the array, but ws.

  14. #14
    Registered User
    Join Date
    07-25-2013
    Location
    Boise, ID
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Collecting Data from multiple worksheets

    Thanks everyone! It works perfectly now I really appreciate the help...this will really help make things easier at my work. Again, thank you. ~Casey

+ 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. [SOLVED] searching multiple worksheets and collecting the results
    By ibis10 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-27-2013, 11:27 PM
  2. Collecting data from multiple worksheets
    By dannyevo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2011, 08:19 AM
  3. Worksheet from template, collecting data from worksheets for a summary...
    By ohhsheetz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-06-2010, 11:22 PM
  4. Collecting data from worksheets.
    By MrSeagull in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2006, 01:50 PM
  5. collecting data from various worksheets
    By NM3383 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-21-2006, 01:50 PM

Tags for this Thread

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