+ Reply to Thread
Results 1 to 9 of 9

copying data from excel files in folder/subfolders

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    copying data from excel files in folder/subfolders

    Hi Guy

    im trying to get this macro to copy data from excel files in folders it works but i need it to get data from excel files in sub-folders aswell can someone please help

    Thanks



    Please Login or Register  to view this content.
    Last edited by Hannspree; 10-21-2015 at 11:58 AM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: copying data from excel files in folder/subfolders

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: copying data from excel files in folder/subfolders

    Describe the process you want to use to achieve your desired results.
    For example: The names of the sub folder(s) will be in a range of cells, I choose which cells and the code does the rest or I want to hard code the sub folder names into the code.

  4. #4
    Registered User
    Join Date
    02-13-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: copying data from excel files in folder/subfolders

    Thanks for the reply

    the excel files are all in random sub folders so it will need to loop though all the folders i need the code to do exactly what it does now but be able to find the excel files in sub folders to copy and paste the data into another excel file (sheet).

  5. #5
    Registered User
    Join Date
    02-13-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: copying data from excel files in folder/subfolders

    Thanks for the reply

    the excel files are all in random sub folders so it will need to loop though all the folders i need the code to do exactly what it does now but be able to find the excel files in sub folders to copy and paste the data into another excel file (sheet).

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: copying data from excel files in folder/subfolders

    That might be a little too much for me.
    I'm sure someone with more knowledge than I will pick up the ball here.
    If I don't see a response in a couple of hours, I'll send someone a PM and ask them to look at it.

  7. #7
    Registered User
    Join Date
    02-13-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: copying data from excel files in folder/subfolders

    Thanks !!!!

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: copying data from excel files in folder/subfolders

    Hi Hannspree,

    Because you are wanting to find and import RANDOMLY named data, I'd suggest you try the Application.FindFile method. This will bring up a dialog where you can manually select the file you want to use/import.

    See if adding this manual process in your code helps with determining the randomness of your work.

    If this doesn't do what you need then look at the "Dir" function. A good example of how it runs through all the files in a directory is at:
    http://www.excel-easy.com/vba/exampl...directory.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  9. #9
    Registered User
    Join Date
    02-13-2014
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: copying data from excel files in folder/subfolders

    Is no way to go though subfolders ? i wanted to make it so they just type in a number and it copied the data in to the sheet the number they type in is the file directory but sometimes its in a folder inside the directory if that make sense

+ 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] list of subfolders in folder - without files and sub-subfolders
    By MartyZ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2022, 10:56 AM
  2. VBA that goes through all xls files in folder and subfolders
    By Acxer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2015, 09:06 AM
  3. Needs macro to copy excel files from folders, subfolders to new folder
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2014, 08:53 AM
  4. [SOLVED] Reading Excel files in folder/subfolders
    By crakter in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-21-2014, 05:48 AM
  5. copying data from excel files in a source folder to target folder
    By Javed07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 04:27 PM
  6. Counting files in folder including subfolders also and folder size
    By mido609 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 03:26 PM
  7. [SOLVED] Opening Excel files in same folder through a Macro - but not subfolders?
    By toffee_madman in forum Excel General
    Replies: 9
    Last Post: 10-19-2011, 11:09 AM

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