View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Sheets to new WorkBook

Try this


Sub test()
Initfile = Sheets("Rec Domectic Forecast - &summ").Range("E3")
Set NewBk = Workbooks.Add
With ThisWorkbook
.Sheets("Sheet1").Copy after:=NewBk.Sheets(NewBk.Sheets.Count)
.Sheets("Sheet2").Copy after:=NewBk.Sheets(NewBk.Sheets.Count)
.Sheets(3).Copy after:=NewBk.Sheets(NewBk.Sheets.Count)
End With
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Initfile, _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
NewBk.SaveAs Filename:=fileSaveName
End If

"Robert S" wrote:

Hey there,

What I have done:

Once the user hits the command button, a userform pops up, the users has 4
options to choose(Checkboxes). Say the user selects all 4, it will create 4
new sheets (all named) and copy data from a summary sheet to these newly
created sheets. It sets the format and print area of all 4 sheets. If the
user selects 1 sheets, it will only create one sheets with the desired
information.

Where I want to go from here.

I would like to be able to create a new workbook, copy over the sheets that
have been created then remove the sheets from the orignal workbook. Then I
would like it to promt the user to save the document (if possible, with
SaveAs name set to some I have pre-difined (="Rec Domectic Forecast -
"&summ!E3) to keep a standard naming convention.

Any ideas how this would be done? I can't seem to copy of the sheets since
the new workbook name changes (book(x)).

Thanks,
Rob