Display a list of files based on 2 or 3 criteria search, the filles could be in different workbooks and subfolders

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
I need to Display a list of files based on 2 or 3 criteria search, the filles could be in different workbooks and subfolders.

I know I will need to use file system objects, I would like to create a userform where a user can choose the files they want to copy to a new folder.

Has anyone done anything similar like this before?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hello Kurt,

What are the criteria you want to use?
 
Upvote 0
Hello Leith,

Thank you for replying. In the first search criteria will be a bank name such as Chase, Wells Fargo, etc.

The second criteria should be an amount say from 300 - 600 million or it could be 700 - 800 million.

I have learned in he past to allow for an extra criteria. I am just not sure what it would be yet.

I hope this helps answer your question.

There will be one main folder and the sub folders will have the bank names, so I don't think it will be several main folders.

I am still in discovery phase.
 
Upvote 0
Is the amount in the file or part of the file name?
 
Upvote 0
BankNameA 300 - 600 Million BankNam3B 200 - 500 Million BankNameC 100-200 Million.

I am using generic names to protect the innocent! haha
 
Upvote 0
Create a userform and add 2 comboboxes
add this code to the userform, change the initial folder location.

When you show the UserForm, combobox 1will list the subfolders
Once you have selected the subfolder combobox2 will list the files in the subfolder

VBA Code:
Private Sub UserForm_Initialize()
    Dim fs, f, f1, fc, s
    Dim folderspec

    folderspec = "C:\TestFolder" & "\"

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(folderspec)
    Set fc = f.SubFolders

    ComboBox1.Clear

    For Each f1 In fc
        ComboBox1.AddItem f1.Name
    Next f1

    ComboBox1.SetFocus

End Sub
Private Sub ComboBox1_Change()

    Dim fs As Object, f As Object, f1 As Object, fc, s
    Dim folderspec

    folderspec = "C:\TestFolder" & "\" & ComboBox1

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(folderspec)
    Set fc = f.Files

    ComboBox2.Clear
    For Each f1 In fc
        ComboBox2.AddItem f1.Name
    Next f1

End Sub
 
Upvote 0
Thanks I will try this but I looked back at my notes.

Those key words can be in a document or a excel spreadsheet.

Is there a way to search inside the documents when the documents are closed?
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top