Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new workbook. I can get the template into the new workbook, but none of the ranges are named. Any ideas? Thank you for the assistance. Don |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i dont understand why you want to copy it to a new workbook.If you open a
true template ie an xlt file it always opens as a new copy of itself use Workbooks.Add Template:= not Workbooks.Open Filename:= -- paul remove nospam for email addy! "Don Rouse" wrote: I have a template with named ranges. I want to use VBA to copy the template into another workbook and have the names of the ranges carried into the new workbook. I can get the template into the new workbook, but none of the ranges are named. Any ideas? Thank you for the assistance. Don |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The template is one sheet. I want to insert it as a sheet in a multi sheet
workbook not open it as a separate workbook or separate template. "paul" wrote: i dont understand why you want to copy it to a new workbook.If you open a true template ie an xlt file it always opens as a new copy of itself use Workbooks.Add Template:= not Workbooks.Open Filename:= -- paul remove nospam for email addy! "Don Rouse" wrote: I have a template with named ranges. I want to use VBA to copy the template into another workbook and have the names of the ranges carried into the new workbook. I can get the template into the new workbook, but none of the ranges are named. Any ideas? Thank you for the assistance. Don |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How are you getting the template to the new workbook?
Are you opening the template workbook, then copying the worksheet (not the cells, but the worksheet), then closing the template? I think that would work. And if you just want to add a new sheet based on a template to an existing workbook: Option Explicit Sub testme() Dim newWks As Object Set newWks = Sheets.Add(Type:="C:\my documents\excel\book1.xlt") End Sub I think if I were doing this, I'd make sure those names were sheet level names--not workbook level names. Insert|Name|Define Names in Workbook: Sheet1!myNameHere Refers to: =Sheet1!$C$6:$G$15 Then I could add the sheet as many times as I want and not have to worry about name conflicts. ====== And if you're working with names, get a copy of Jan Karel Pieterse's (with Charles Williams and Matthew Henson) Name Manager: You can find it at: NameManager.Zip from http://www.oaltd.co.uk/mvp You'll be very happy you did. Don Rouse wrote: I have a template with named ranges. I want to use VBA to copy the template into another workbook and have the names of the ranges carried into the new workbook. I can get the template into the new workbook, but none of the ranges are named. Any ideas? Thank you for the assistance. Don -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, Dave. Problem solved.
Don "Dave Peterson" wrote: How are you getting the template to the new workbook? Are you opening the template workbook, then copying the worksheet (not the cells, but the worksheet), then closing the template? I think that would work. And if you just want to add a new sheet based on a template to an existing workbook: Option Explicit Sub testme() Dim newWks As Object Set newWks = Sheets.Add(Type:="C:\my documents\excel\book1.xlt") End Sub I think if I were doing this, I'd make sure those names were sheet level names--not workbook level names. Insert|Name|Define Names in Workbook: Sheet1!myNameHere Refers to: =Sheet1!$C$6:$G$15 Then I could add the sheet as many times as I want and not have to worry about name conflicts. ====== And if you're working with names, get a copy of Jan Karel Pieterse's (with Charles Williams and Matthew Henson) Name Manager: You can find it at: NameManager.Zip from http://www.oaltd.co.uk/mvp You'll be very happy you did. Don Rouse wrote: I have a template with named ranges. I want to use VBA to copy the template into another workbook and have the names of the ranges carried into the new workbook. I can get the template into the new workbook, but none of the ranges are named. Any ideas? Thank you for the assistance. Don -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy/Paste Doesn't Carry Formats | Excel Worksheet Functions | |||
copy formula from 1 workbook to another & not carry the extension | Excel Worksheet Functions | |||
i need a template to carry out vat returns in excel | Excel Worksheet Functions | |||
copy sheet1 and name sheets using names from a range | Excel Programming |