ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to create workbook with multiple sheets (https://www.excelbanter.com/excel-discussion-misc-queries/100136-how-create-workbook-multiple-sheets.html)

control freak

How to create workbook with multiple sheets
 
I need to copy a certain sheet in my workbook a number of times to a
new workbook, I can do this with this code to a point i get errors,
sort of new to excel macros. not sure how to place the saveworkbook
command (without it i can copy multiple sheets(according to list) in
the same workbook, but i need to create a new workbook with the
multiple worksheet copies.

Private Sub CommandButton1_Click()
With Worksheets("START")
For Each cell In .Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
If Not IsEmpty(cell) Then
Worksheets("template").Copy After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = cell.Value
End If
Next
End With
ActiveWorkbook.SaveAs Filename:="NewFile.xls", _
FileFormat:=xlNormal
End Sub


any hints.

Thanks



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com