+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: Selecting certain rows across workbooks and compiling into one workbook

  1. #1
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Selecting certain rows across workbooks and compiling into one workbook

    I receive auto-generated daily reports on various sales metrics on an associate/daily level. I need to be able to specify an associate via their unique parameters (store number + last name + first name, for instance) and have a macro go through my reports from each day pulling their one line and dropping them into another sheet for analysis. I don't know if I should get each report into one workbook (copy all the sheets into one workbook?) or if (since the sheet name is the same across all workbooks) a macro could just go through every XLS in a folder.

    The only other thing I need it to do is differentiate where each line came from - in a static location on every workbook is the generation date, so if when it pulls an associate from 1/17's report and drops it into the summary sheet it puts the date next to them it'd be perfect.

    I'm versed in Java, however databasing and VBA is very new to me so pardon me if I've made any crazy assumptions.

    Attached is a sample with names deleted; the one thing that might make it tricky is when I get the reports its usually a two-sheet thing; theres a rolling MTD page I don't use or care about in each real XLS. However, the sheet I want data from is always named Sheet1, with only the workbook name changing.
    Attached Files Attached Files
    Last edited by CapnSef; 02-07-2012 at 07:20 PM.

  2. #2
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    bump no response

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

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Should the data for the associate be copied to one worksheet only in a new workbook?
    Cheers,
    Arlette

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Yes, the data can be in a totally separate document. The one issue is the data is being pulled across several other workbooks from the same directory on the PC. However, they all have the same Sheet1 in them. Thank you again so much!

    Edit: So, to clarify, if I have 10 XLS documents in a directory it should open each one, search for an associate, and if it finds that associate it should copy that row along with the date into another (new) workbook. It should repeat this process, compiling all of that associates appearances into one sheet alongside the date the row was pulled from. On the example I provided, the date occurs in the static cell of C2.
    Last edited by CapnSef; 01-21-2012 at 10:35 PM.

  5. #5
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Bump no response (let me know if you have any other questions Arlu!)

  6. #6
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Bump no response (I hope this isn't an outlandish request :/)

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

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Sorry, as i was working on your request i faced another problem - How will the associate be selected? Will it be a dropdown? Or should this task be done for all associates one at a time?
    Cheers,
    Arlette

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  8. #8
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    A fill-in GUI would be exceptional; I figured I could even just go into the script and change the variables myself. For instance, one variable for Store #, one for Lastname, one for Firstname?

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

    Re: Selecting certain rows across workbooks and compiling into one workbook

    But would you want to do this each time you run the macro? Instead you can have a dropdown on a main page (sheet1 or something) so you can then change it in the front and the code takes in these changes.
    Cheers,
    Arlette

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    That sounds to be very convenient, arlu1201. So long as the dropdown could handle such a high number of records in its list, that would be a very good solution. You're right, each time I run the macro it would be on a different associate.

    Edit: arlu, does your script assume I have multiple workbooks or one workbook with many worksheets? I can do either, I just wasn't sure which route you've taken.
    Last edited by CapnSef; 01-25-2012 at 08:23 PM.

  11. #11
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Bump no resposne

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

    Re: Selecting certain rows across workbooks and compiling into one workbook

    It depends on your layout. You select whether you want multiple workbooks or 1 workbook with many worksheets. Ideally, to make the code less complicated, the 2nd option (one workbook with many worksheets) is better. You tell me what you choose and i can create your code with that.
    Cheers,
    Arlette

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  13. #13
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Completely understandable, arlu.

    Luckily, thanks to user snb on these forums I have this code:

    Sub snb()
      c01 = Dir(ThisWorkbook.Path & "\*.xls")
    
      Do Until c01 = ""
        if c01<> thisworkbook.name then
          With GetObject(ThisWorkbook.Path & "\" & c01)
            .Sheets("Sheet1").Copy , ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
            .Close False
          End With
        end if
        c01 = Dir
      Loop
    End Sub
    Which compiles all my annoying workbooks into one master workbook, with each day as a separate sheet.

    So, at our present state, the macro simply needs to be able to run within a workbook with several sheets named "Sheet1(1)," "Sheet1(2)," etc and pull a particularly defined associate out and plop them into a new workbook/sheet/whatever alongside the date from the sheet they were pulled (I think cell C2 always contains the date).

    So the output would be like:

    1/17 (associate row)
    1/18 (associate row)
    1/20 (associate row)

    Some days an associate may not work or have any data, so it would be understandable if days were skipped - but every time an associate appears on a sheet, he or she should be copied out if he or she meets the defined critera.

    Please let me know if things are unclear and I GREATLY appreciate all your patience!

  14. #14
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Bump no response

    Arlu
    Please let me know if you encounter any other snags or questions in our efforts to find a soluton to this

    Thank you again so much

  15. #15
    Registered User
    Join Date
    01-17-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Selecting certain rows across workbooks and compiling into one workbook

    Bump no response

    Arlu, is there anything I can do to help you with this or do you think this is something you're unable to do?

+ 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.2.0