Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
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
Merging workbooks into different sheets in a different workbook Nico Excel Discussion (Misc queries) 0 November 6th 07 07:49 AM
building chart from multiple sheets Brad K. Charts and Charting in Excel 1 October 26th 07 02:04 PM
building several workbooks from several workbooks eze Excel Discussion (Misc queries) 0 March 6th 07 06:11 PM
Printer error building Excel workbook...? Martin[_15_] Excel Programming 1 February 26th 04 04:00 PM
How do you list all the workbooks you have opened and the sheets in each workbook? Wendy[_3_] Excel Programming 1 December 5th 03 09:17 PM


All times are GMT +1. The time now is 03:06 AM.

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

About Us

"It's about Microsoft Excel"