View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default If Statement to place .xls within .xls

Dim spath as String, sStr as String
Dim i as long
Dim bk as Workbook, bk1 as Workbook
spath = "C:\myfolder\myfiles\"
set bk = workbooks.Add
for i = 1 to 31
sStr = dir(spath & "day" & i & ".xls")
if sStr < "" then
set bk1 = workbooks.open(sPath & sStr)
bk1.worksheets(1).copy After:=bk.Worksheets(1)
bk1.Close Savechanges:=False
end if
Next
Bk.SaveAs "C:\Myfolder\MyMonths\month.xls"

--
Regards,
Tom Ogilvy


"bawahoo" wrote in message
...

Can someone help me with the IF statement to place .xls within a .xls. I
have created a Monarch Macro that captures all the data for the day and
saved it as Day1.xls, now I need to place all the DayX.xls files into a
Month.xls. Please help. Thanks in advance.


--
bawahoo
------------------------------------------------------------------------
bawahoo's Profile:

http://www.excelforum.com/member.php...o&userid=15102
View this thread: http://www.excelforum.com/showthread...hreadid=272851