View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default loop thru folder looking for files with date code in name

sData ="*20090905*"
....
....
if sFilename LIKE sDate then


It worked great, thank you. You also alerted me the to function "LIKE"
which is new to me.


I also like the Like function<g... it is very flexible; but, I think in
this situation, I think I would use a simple InStr test instead, mainly
because InStr is a more efficient function than the Like operator (it
executes faster than the Like operator does which can be important in large
loops).

sData = "20090905"
.....
.....
If InStr(sFilename, sData) 0 Then

If you are not completely familiar with the InStr function, you should look
it up in the help files... there are optional arguments which allows you to
make the search case insensitive (which is not important in your current
needs, of course).

--
Rick (MVP - Excel)