View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Find Correct Subdirectory

Let us know if this helps.

Sub finddir()
Dim mypath, myname
mypath = "c:\yourfolder\"
myname = Dir(mypath, vbDirectory)
Do While myname < ""
If myname = "yourname" Then ChDir "c:\personal\yourname": Exit Sub
myname = Dir
Loop
End Sub

--
Don Guillett
SalesAid Software

"Stratuser" wrote in message
...
I want to change the current subdirectory to the one that is one level

higher
and contains the string "Russell". I know how to change the directory to
one level higher (ChDir ".."). How can I loop through the subdirectories

to
find the one containing the word "Russell"?