Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
building new workbook from sheets in different workbooks
Hi,
can anyone help, please? I've 5 workbooks, each containing the sheets A-Z (Customernames). Now I need a macro that goes into each of the workbooks, selects all sheets with name "A" and saves it as new file "A", then goes back and continues with sheet "B" and so on. Anyone an idea? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
building new workbook from sheets in different workbooks
create a file that holds the customernames in a list (A2:A15),
highlight the first customer, open all workbooks holding customer information Sub Create_CostCentrePack() Application.ScreenUpdating = False Dim CostCentre As String Do While True ActiveCell.Select CostCentre = ActiveCell.FormulaR1C1 'MsgBox CostCentre Workbooks.Add ChDir "H:\Test" (to be replaced by final path) ActiveWorkbook.SaveAs Filename:="H:\Test\" & CostCentre & ".xls", _ FileFormat:=xlNormal, CreateBackup:=False Windows("file which contains sheets to be copied").Activate Sheets(CostCentre).Select Sheets(CostCentre).Copy Befo=Workbooks(CostCentre).Sheets(1) Windows("second file which contains sheets to be copied").Activate Sheets(CostCentre).Select Sheets(CostCentre).Copy Befo=Workbooks(CostCentre).Sheets(2) (....and so on) ActiveWorkbook.Save ActiveWindow.Close Windows("Macro.xls").Activate ActiveCell.Offset(1, 0).Range("A1").Select Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Merging workbooks into different sheets in a different workbook | Excel Discussion (Misc queries) | |||
building chart from multiple sheets | Charts and Charting in Excel | |||
building several workbooks from several workbooks | Excel Discussion (Misc queries) | |||
Printer error building Excel workbook...? | Excel Programming | |||
How do you list all the workbooks you have opened and the sheets in each workbook? | Excel Programming |