Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default copy worksheets between workbooks - including named ranges

Hi,

I'm working on a workbook which makes extensive use of named ranges
(which is good). However, depending on what a user selects, one of the
worksheets may need to be replaced with another (the user can select
whether to run a "full" or "mini" run of the model, if a mini is run
then one sheet needs to be replaced).

Because the rest of the sheets in the workbook reply on named ranges
in the "full" sheet, when it is replaced with the "mini", I need the
same named ranges to be there.

I am trying to replace the sheet as follows:


Set sourceworkbk = Workbooks("Valuation_mini.xls")
Set destworkbk = Workbooks("Valuation_full.xls")
' copy the worksheet over
sourceworkbk.Worksheets("mini calculation").Copy
after:=destworkbk.Worksheets(destworkbk.Worksheets .count)

this copies the worksheet into the workbook fine, but does not appear
to bring the named ranges with it. I.e. named ranges defined in
Valuation_mini.xls are not available once the sheet is copied into
Valuation_full.xls.

Is there any way to force it to bring named ranges with it?

Thanks in advance,

Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default copy worksheets between workbooks - including named ranges

Isn't that its default behaviour?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"christian_spaceman" wrote in message
...
Hi,

I'm working on a workbook which makes extensive use of named ranges
(which is good). However, depending on what a user selects, one of the
worksheets may need to be replaced with another (the user can select
whether to run a "full" or "mini" run of the model, if a mini is run
then one sheet needs to be replaced).

Because the rest of the sheets in the workbook reply on named ranges
in the "full" sheet, when it is replaced with the "mini", I need the
same named ranges to be there.

I am trying to replace the sheet as follows:


Set sourceworkbk = Workbooks("Valuation_mini.xls")
Set destworkbk = Workbooks("Valuation_full.xls")
' copy the worksheet over
sourceworkbk.Worksheets("mini calculation").Copy
after:=destworkbk.Worksheets(destworkbk.Worksheets .count)

this copies the worksheet into the workbook fine, but does not appear
to bring the named ranges with it. I.e. named ranges defined in
Valuation_mini.xls are not available once the sheet is copied into
Valuation_full.xls.

Is there any way to force it to bring named ranges with it?

Thanks in advance,

Chris



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default copy worksheets between workbooks - including named ranges

It doesn't appear to be. A named range available in the sheet before
the copy isn't in the destination book after the copy.




On Dec 20, 12:55 pm, "Bob Phillips" wrote:
Isn't that its default behaviour?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"christian_spaceman" wrote in message

...



Hi,


I'm working on a workbook which makes extensive use of named ranges
(which is good). However, depending on what a user selects, one of the
worksheets may need to be replaced with another (the user can select
whether to run a "full" or "mini" run of the model, if a mini is run
then one sheet needs to be replaced).


Because the rest of the sheets in the workbook reply on named ranges
in the "full" sheet, when it is replaced with the "mini", I need the
same named ranges to be there.


I am trying to replace the sheet as follows:


Set sourceworkbk = Workbooks("Valuation_mini.xls")
Set destworkbk = Workbooks("Valuation_full.xls")
' copy the worksheet over
sourceworkbk.Worksheets("mini calculation").Copy
after:=destworkbk.Worksheets(destworkbk.Worksheets .count)


this copies the worksheet into the workbook fine, but does not appear
to bring the named ranges with it. I.e. named ranges defined in
Valuation_mini.xls are not available once the sheet is copied into
Valuation_full.xls.


Is there any way to force it to bring named ranges with it?


Thanks in advance,


Chris- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop named ranges from copying into other workbooks Mike Excel Worksheet Functions 1 April 2nd 08 04:23 PM
How do I copy a group of worksheets with named ranges in Excel 200 sc Excel Worksheet Functions 2 September 26th 06 12:16 AM
Named ranges which seem to reference old workbooks/worksheets mhudsonak Excel Discussion (Misc queries) 2 September 11th 06 03:42 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
Named Ranges - Slow Workbooks! Karl Burrows Excel Programming 4 April 6th 04 07:19 PM


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"