find a text in a file name
Tom,
Thanks for the help.
As usual clean and right to the point.
Thanks again
"Tom Ogilvy" wrote:
sName = Dir("C:\Someplace\*.xls")
Do while sName < ""
if instr(sName, "YTD") then
workbooks.Open "C:\Someplace\" & sName
worksheets(1).Range("B3").Value = "YTD"
activeWorkbook.Close SaveChanges:=True
end if
sName = Dir()
Loop
--
Regards,
Tom Ogilvy
"vlad" wrote in message
...
I need to loop throught n- number of files in a directory and if there is
a
string "YTD" in the file name I had to put in cell B3 the string "YTD" and
close it.
Any help with the code will be appreciated
Thanks
Vlad
|