Replace the line
Set wb = Workbooks.Open(sfilename)
with the following:
NewestFileName = sfilename
FileDate = FileDateTime(sfilename)
Do while sfilename < ""
sfilename = sPath & "\" & dir()
if FileDateTime(sfilename) FileDate then
NewestFileName = sfilename
FileDate = FileDateTime(sfilename)
end if
loop
Set wb = Workbooks.Open(NewestFileName)
--
colofnature
------------------------------------------------------------------------
colofnature's Profile:
http://www.excelforum.com/member.php...o&userid=34356
View this thread:
http://www.excelforum.com/showthread...hreadid=544793