+ Reply to Thread
Results 1 to 11 of 11

Get data from all workbooks in folder

  1. #1
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Get data from all workbooks in folder

    A while back someone helped me out with a code to pull data out of all workbooks in a folder. This is the code
    Please Login or Register  to view this content.
    This code works flawless!

    What I thought I could do with this code is create another file with this code, change a few things and have it work in another folder with a bunch of files pulling infromation from cells...(Clear as mud?) Well, it's not that easy I guess... for a nub anyway

    What can I do to make this code work for different files? The files I am working with in a folder now are named like this 01-02-08_All.xls. Only the date changes in the nameing. Sorry I don't remember exactly who wrote this code but I think it was that really smart guy "Ross" but I could be wrong. Found the old post.. it was that elite Richard Buttrey that first helped me with this code!
    Last edited by Tortus; 12-08-2008 at 04:59 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    If you are just needing the same but for another folder other than your workbook's path with that code, change:
    Please Login or Register  to view this content.
    to your path, something like:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417
    What I changed was the name of the sheet from
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Even thought the file names are different, does it matter?
    I do not get a debug or any errors, it just doesnt bring anything from the other spreadsheets in the folder.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You need to step through the code with F8 to see if it doing what you think. You have a typo for one of your sheet names count.

  5. #5
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417
    its spelt right in the code... i just missed it here

    when I step through the code I don't see anything wrong and the only thing different is the file names in the folder

    I've moved both files to a seperate folder to work through the problem. So, I have 2 workbooks in one folder. One workbook has the code attached to a button and the other has data. When I press the button, cells from sheet "counts" E3, E4, E5 should appear!

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Try this on backup copies. I haven't tested this. It probably needs a bit more testing. The other code was checking for a pattern. The "*_All.xls" shold be sufficient.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417
    That code didn't work. Did the same thing.

    All the files in this folder are named "MM-DD-YR_All.xls" except the file I'm using the code with.

    I would like to pull these cells from the "counts" sheet in every file in this folder.

    E3,E4,E5... through E19. Seperatly so not E3:E19

  8. #8
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764
    Hi
    Save the attached file in the folder where you want the data from and run the macro.
    Ravi
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417
    That was cool. I looked at the code and I'm trying to figure out what I can change to make other colums appear in this sheet.

    So If I wanted B, C, D, E, F to come in from all the workbooks, what has to change?

    Update.... I figured it out but what I can't figure out is how to make it skip down the page a couple of rows before running the next macro. After pulling in C.. skip a few rows and pull in D.. skip a few rows....etc. I copied the macro and renamed it, then replaced all the "e" with "c" but it is over writing the "e"
    Last edited by Tortus; 12-05-2008 at 12:54 AM.

  10. #10
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    modified macro

    Hi
    Try this modification
    Ravi
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417
    Thank you!

+ 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