+ Reply to Thread
Results 1 to 6 of 6

import largest csv contained within subfolders

  1. #1
    Registered User
    Join Date
    03-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question import largest csv contained within subfolders

    long time lurker here. I can usually find what I need from others' posts but I'm stuck this time.
    I have a large set of .CSV files I'm generating within multiple subfolders (the parent folder is constant). The .CSVs are eventually deleted and replaced with new .CSVs. The total count of .CSVs can vary from time to time (usually from 10 to 50). There is always a specific .CSV of interest, and it is ALWAYS the largest .CSV in the set. However, its filename and location can change (within the subfolders contained in the parent folder). I want to be able to automatically import the largest csv.
    Example directory structure where CSV6.csv would be imported:
    Please Login or Register  to view this content.
    I found this post and tried to play around with it but didn't have any luck:
    http://www.excelforum.com/excel-prog...gest-file.html

  2. #2
    Registered User
    Join Date
    03-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: import largest csv contained within subfolders

    bump no response

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: import largest csv contained within subfolders

    This will demonstrate one way to do it. You can use the fNAME string that is stored to feed into your other macro as the import filename.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 11-12-2014 at 05:22 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    03-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: import largest csv contained within subfolders

    awesome! that's working pretty darn well. I ran into a wierd issue though. If I rerun the macro after changing the CVSs a few times, the fname reference gets stuck on the previous/incorrect file. Reopening the workbook fixes the issue so it's no big deal. Thanks for the help!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: import largest csv contained within subfolders

    Maybe just reset that on your way out at the end:
    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    03-30-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: import largest csv contained within subfolders

    i'll try that out. thanks again!

+ 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. Import .xls files from subfolders into one file
    By anna mo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2014, 09:33 AM
  3. [SOLVED] filename contained in a cell to import data
    By AnnieMcken in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2013, 02:27 AM
  4. csv import from Folder with several subfolders and subsubfolders
    By Guesty in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2013, 07:13 AM
  5. Replies: 0
    Last Post: 01-05-2006, 09:45 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