![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Location: Cincinnati, OH
Posts: 4
|
OK, here's my situation. I have 4 workbooks (EAST, WEST, CENTRAL, OMG), each have only one sheet (Sheet1) per workbook. What I want to do is create another workbook (LOG.xls) with 4 sheet's (one for each of the previous workbook's data) and be able to somehow link/copy all the data from East, WEST, CENTRAL, and OMG into the new sheet's (one per sheet) in the new workbook (LOG.xls). I hope that makes sense
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
So, basically you want to combine your 4 original workbooks into 1 new workbook. Is this correct? Do you need a macro to do it.
You can do this by hand, by right clicking on each worksheet|Move or Copy|(new book)|Create a copy|Ok|repeat for the rest of the worksheets|Save your new workbook as LOG.xls
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Location: Cincinnati, OH
Posts: 4
|
I probably need a macro, because I want it to be able to update the LOG.xls when someone edits one of the other 4 files. So it'd probably have to run the macro everytime someone opens LOG.xls. Could you PELEASE, I'm just about begging here. Someone give me the code for the macro to do this? I need it for work, and I don't have a whole lot of time. Thanks in advance!
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following code:
Sub CombineWorkbooks() Application.DisplayAlerts = False Dim NEWBOOK, FNAME Application.SheetsInNewWorkbook = 1 Set NEWBOOK = Workbooks.Add FNAME = "c:LOG.xls" NEWBOOK.SaveAs Filename:=FNAME Windows("EAST.xls").Activate Sheets("Sheet1").Copy Before:=NEWBOOK.Sheets(1) Windows("WEST.xls").Activate Sheets("Sheet1").Copy Before:=NEWBOOK.Sheets(1) Windows("CENTRAL.xls").Activate Sheets("Sheet1").Copy Before:=NEWBOOK.Sheets(1) Windows("OMG.xls").Activate Sheets("Sheet1").Copy Before:=NEWBOOK.Sheets(1) NEWBOOK.Sheets(5).Delete NEWBOOK.Save Application.DisplayAlerts = True End Sub
__________________
Kind regards, Al Chara |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|