ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create New Sheet from template sheet (https://www.excelbanter.com/excel-programming/376345-create-new-sheet-template-sheet.html)

David Coyle[_2_]

Create New Sheet from template sheet
 
Hi,

I am currently creating new sheet using the following code:

Private Sub cmdNewSheet_Click()
Sheets.Add Befo=Sheets("Finish"), Type:="C:\Documents and
Settings\Administrator\My Documents\Stock Control\StockTemplate1.xlt"
Sheets(Sheets.Count - 1).Name = txtNewSheet.Text
txtNewSheet.Text = ""
End Sub

What i would like to do is manipulate the code to create the sheet, but
instead of using the file 'Template1.xlt', i would like it to create them
from a worksheet called Temp.

Does anyone have any ideas? Is it even possible?

Thank you in anticipation.

Dave Peterson

Create New Sheet from template sheet
 
Just copy the sheet.

worksheets("Temp").copy _
befo=worksheets(1)

And move it/rename it to what you want.

That Temp worksheet is in the same workbook, right?

David Coyle wrote:

Hi,

I am currently creating new sheet using the following code:

Private Sub cmdNewSheet_Click()
Sheets.Add Befo=Sheets("Finish"), Type:="C:\Documents and
Settings\Administrator\My Documents\Stock Control\StockTemplate1.xlt"
Sheets(Sheets.Count - 1).Name = txtNewSheet.Text
txtNewSheet.Text = ""
End Sub

What i would like to do is manipulate the code to create the sheet, but
instead of using the file 'Template1.xlt', i would like it to create them
from a worksheet called Temp.

Does anyone have any ideas? Is it even possible?

Thank you in anticipation.


--

Dave Peterson


All times are GMT +1. The time now is 09:30 AM.

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