Finding files with Excel?

Greg

New Member
I have a problem. My boss has the capability of opening his Excel spreadsheet, typing in part of a filename and retrieving any file that contains that part in their filenames. When I try to type in a part of a filename on my computer's Excel spreadsheet, I have to use asterixes before it'll bring up any files with that part in their filenames.

How do I configure my desktop like that?
 
VBA Filefinder

i updated my file, what searches in one directory for a string in a filename.
changing or choosing another dir would also be possible. you may only have to change the "tabelle1" in ??sheet1??? ... sorry, i'm austrian and not familiar with english excel sheets.

add this macro in your vba by adding a module and rename it. lower- or uppercase does'nt matter, makro will change.
hope it works 4 you

bye
Sub stringfinder()
Dim name1, search As String
Dim n As Integer

Set sheet2 = Worksheets("Tabelle2")
Set sheet1 = Worksheets("Tabelle1")
name1 = Dir("C:\WINNT\*", vbDirectory)

search = InputBox("Search for what string ?", "Search value")
n = 1
Do While name1 <> ""
If name1 <> "." And name1 <> ".." Then
If InStr(1, LCase(name1), LCase(search)) > 0 Then
Worksheets("Tabelle1").Range("A" & n) = name1
n = n + 1
End If
End If
name1 = Dir
Loop
End Sub
 
Back
Top