Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Combining 3 workbooks to one

I have three workbooks, they are titled "APPL CK Today", "APPL CC Today", and
"PPLA CC Today". Each workbook has just a single sheet. I want to combine
those three Workbooks into one WB titled "Recap" with three sheets, the
sheets would be titled "APPL CK Today", "APPL CC Today", and "PPLA CC Today"
and be a copy of the orginal report.

All of the reports are located C:\Documents and
Settings\jouimet\Desktop\Todays Reports

I appreciate your help, thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Combining 3 workbooks to one

Sub Combinebooks()
Dim sPath as String
Dim bk as Workbook, bk1 as Workbook
Dim bk2 as Workbook

spath = "C:\Documents and Settings\jouimet\Desktop\Todays Reports\"

if dir(sPath & "Recap.xls") < "" then
kill sPath & "Recap.xls"
End if

set bk = Workbooks.open(spath & "APPL CK Today.xls")
set bk1 = workbooks.Open(sPath & "APPL CC Today.xls")
set bk2 = workbooks.Open(sPath & "PPLA CC Today.xls")
bk1.worksheets(1).copy After:=bk.Worksheets(1)
bk.worksheets(2).name = "APPL CC Today"
bk2.worksheets(1).copy After:=bk.worksheets(2)
bk.Worksheets(2).Name = "PPLA CC Today"
bk.worksheets(1).Name = "APPL CK Today"
bk.SaveAs sPath & "Recap.xls"
bk1.close Savechanges:=False
bk2.Close Savechanges:=False
bk.close Savechanges:=False
End Sub

--
Regards,
Tom Ogilvy

"SITCFanTN" wrote:

I have three workbooks, they are titled "APPL CK Today", "APPL CC Today", and
"PPLA CC Today". Each workbook has just a single sheet. I want to combine
those three Workbooks into one WB titled "Recap" with three sheets, the
sheets would be titled "APPL CK Today", "APPL CC Today", and "PPLA CC Today"
and be a copy of the orginal report.

All of the reports are located C:\Documents and
Settings\jouimet\Desktop\Todays Reports

I appreciate your help, thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Combining 3 workbooks to one

Thanks Tom, I can see exactly what this code is doing, I appreciate your
help. thanks

"Tom Ogilvy" wrote:

Sub Combinebooks()
Dim sPath as String
Dim bk as Workbook, bk1 as Workbook
Dim bk2 as Workbook

spath = "C:\Documents and Settings\jouimet\Desktop\Todays Reports\"

if dir(sPath & "Recap.xls") < "" then
kill sPath & "Recap.xls"
End if

set bk = Workbooks.open(spath & "APPL CK Today.xls")
set bk1 = workbooks.Open(sPath & "APPL CC Today.xls")
set bk2 = workbooks.Open(sPath & "PPLA CC Today.xls")
bk1.worksheets(1).copy After:=bk.Worksheets(1)
bk.worksheets(2).name = "APPL CC Today"
bk2.worksheets(1).copy After:=bk.worksheets(2)
bk.Worksheets(2).Name = "PPLA CC Today"
bk.worksheets(1).Name = "APPL CK Today"
bk.SaveAs sPath & "Recap.xls"
bk1.close Savechanges:=False
bk2.Close Savechanges:=False
bk.close Savechanges:=False
End Sub

--
Regards,
Tom Ogilvy

"SITCFanTN" wrote:

I have three workbooks, they are titled "APPL CK Today", "APPL CC Today", and
"PPLA CC Today". Each workbook has just a single sheet. I want to combine
those three Workbooks into one WB titled "Recap" with three sheets, the
sheets would be titled "APPL CK Today", "APPL CC Today", and "PPLA CC Today"
and be a copy of the orginal report.

All of the reports are located C:\Documents and
Settings\jouimet\Desktop\Todays Reports

I appreciate your help, thank you.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Combining 3 workbooks to one

From what you say, this appears to be a one-time thing. Do this. Open all
4 files. Then go into each of the 3 files from which you want to copy and
do Edit - Move Or Copy Sheet, select to make a copy, select the fourth file
as the destination, and click OK. This will put the 3 sheets from the 3
files into the fourth file. Is this what you want to do? Post back if I
missed your intention. HTH Otto
"SITCFanTN" wrote in message
...
I have three workbooks, they are titled "APPL CK Today", "APPL CC Today",
and
"PPLA CC Today". Each workbook has just a single sheet. I want to
combine
those three Workbooks into one WB titled "Recap" with three sheets, the
sheets would be titled "APPL CK Today", "APPL CC Today", and "PPLA CC
Today"
and be a copy of the orginal report.

All of the reports are located C:\Documents and
Settings\jouimet\Desktop\Todays Reports

I appreciate your help, thank you.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Combining 3 workbooks to one

Hi Otto,

Actually I need to combine these 3 XLS reports to one workbook so I can
create a daily report each day. I plan on pulling specific data for each
report via a macro and thought it would be much easier if the reports all
resided in the same workbook. Is my thought process wrong?

Thanks
Joyce

"Otto Moehrbach" wrote:

From what you say, this appears to be a one-time thing. Do this. Open all
4 files. Then go into each of the 3 files from which you want to copy and
do Edit - Move Or Copy Sheet, select to make a copy, select the fourth file
as the destination, and click OK. This will put the 3 sheets from the 3
files into the fourth file. Is this what you want to do? Post back if I
missed your intention. HTH Otto
"SITCFanTN" wrote in message
...
I have three workbooks, they are titled "APPL CK Today", "APPL CC Today",
and
"PPLA CC Today". Each workbook has just a single sheet. I want to
combine
those three Workbooks into one WB titled "Recap" with three sheets, the
sheets would be titled "APPL CK Today", "APPL CC Today", and "PPLA CC
Today"
and be a copy of the orginal report.

All of the reports are located C:\Documents and
Settings\jouimet\Desktop\Todays Reports

I appreciate your help, thank you.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining several workbooks rwaldsmith Excel Discussion (Misc queries) 1 June 13th 08 12:17 AM
Combining Workbooks RonnieF Charts and Charting in Excel 0 May 17th 07 08:40 PM
combining workbooks Fawn Excel Worksheet Functions 0 April 13th 05 03:24 AM
Combining workbooks RC Excel Discussion (Misc queries) 2 December 21st 04 10:15 AM
Combining several workbooks into one Anders Eriksson Excel Programming 4 May 13th 04 04:53 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"