Sheets("sheet1").Copy

  • Thread starter Thread starter Little Penny
  • Start date Start date
L

Little Penny

Sheets("sheet1").Copy

This line of code copies the sheet1 to a new workbook useing the
default template. Is there a way to put into the code and tell excel
which template to use.

I want to avoid changing everyone default template.
 
What do you mean by default template??? That line of code copies the sheet
with tab name "sheet1" from the active workbook to a new workbook.
 
I don't understand.

This'll copy that sheet1 to a new workbook--there's no template involved (no
workbook template and no worksheet template).
 
Are you thinking of Word where there is a Normal.dot file. XL has nothing
similar...
 
I ceated a excel tempalte the include serveral macro.

I want to be able use

Sheets("sheet1").Copy

But have excel use the template to open the new workbook
 
Create a new workbook that uses that template.
Copy the worksheet into that workbook.

Dim NewWkbk As Workbook
Dim WksToCopy As Worksheet

Set WksToCopy = ActiveWorkbook.Worksheets("Sheet1")

Set NewWkbk = Workbooks.Add(template:="C:\folder\yourtemplatename.xlt")

WksToCopy.Copy _
before:=NewWkbk.Worksheets(1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top