7
71marco71
Dear friends
I have the macro below that works fine but I don’t understand how the
new workbook that will contain all sheets is open (I can see a copy
command but I don’t see a paste command). How can I give a specific
name to the new workbook and save it in a specific forlder? I would
like also close the workbook I had previously open without saving it.
Thank you very much for your help
bkList = Array("Bk1.xls", "Bk2.xls", "Bk3.xls", _
"Bk4.xls", "Bk5.xls", "Bk6.xls", "Bk7.xls")
for i = lbound(bkList) to ubound(bklist)
set wkbk = workbooks.Open(blList(i))
if i = lbound(bkList) then
wkbk.Sheets.copy
set wkbk1 = ActiveWorkbook
else
wkbk.Sheets.Copy After:=wkbk1.Sheets(wkbk1.sheets.count)
end if
Next
' now delete sheets you don't want
wkbk1.Sheets.Select
activewindows.SelectedSheets.Printout
I have the macro below that works fine but I don’t understand how the
new workbook that will contain all sheets is open (I can see a copy
command but I don’t see a paste command). How can I give a specific
name to the new workbook and save it in a specific forlder? I would
like also close the workbook I had previously open without saving it.
Thank you very much for your help
bkList = Array("Bk1.xls", "Bk2.xls", "Bk3.xls", _
"Bk4.xls", "Bk5.xls", "Bk6.xls", "Bk7.xls")
for i = lbound(bkList) to ubound(bklist)
set wkbk = workbooks.Open(blList(i))
if i = lbound(bkList) then
wkbk.Sheets.copy
set wkbk1 = ActiveWorkbook
else
wkbk.Sheets.Copy After:=wkbk1.Sheets(wkbk1.sheets.count)
end if
Next
' now delete sheets you don't want
wkbk1.Sheets.Select
activewindows.SelectedSheets.Printout