+ Reply to Thread
Results 1 to 2 of 2

sort data from multiple sub folders

Hybrid View

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    7

    sort data from multiple sub folders

    Hi
    I have a code that open multiple sub folders and selects different information from any excel file.
    The code is

    Dim fName As String
        Dim fPath As String: fPath = "e:\Departments\Test Reports\Data\"
        Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
        Dim FLD As Object: Set FLD = FSO.GetFolder(fPath)
    The folder DATA has the sub folders DATA 1 DATA 2 DATA 3 MATERIALS, all have excel files,
    How can i modify the code so it does not read the folder MATERIALS ?
    I have tried \data\data_? and \data\data_*

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: sort data from multiple sub folders

    Maybe something like this...

        Dim fName As String
        Dim fPath As String: fPath = "e:\Departments\Test Reports\Data\"
        Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
        Dim FLD As Object
        For Each FLD In FSO.GetFolder(fPath).Subfolders
            If FLD.Name Like "DATA*" Then
                'Do stuff here
            End If
        Next FLD

+ 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