PC Review


Reply
Thread Tools Rate Thread

copy worksheets between workbooks - including named ranges

 
 
christian_spaceman
Guest
Posts: n/a
 
      20th Dec 2007
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
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      20th Dec 2007
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" <(E-Mail Removed)> wrote in message
news:9d209c23-c353-4c00-96a5-(E-Mail Removed)...
> 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



 
Reply With Quote
 
christian_spaceman
Guest
Posts: n/a
 
      20th Dec 2007
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" <bob....@somewhere.com> 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" <chris_cul...@yahoo.com> wrote in message
>
> news:9d209c23-c353-4c00-96a5-(E-Mail Removed)...
>
>
>
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I copy a group of worksheets with named ranges in Excel 200 =?Utf-8?B?c2M=?= Microsoft Excel Worksheet Functions 2 26th Sep 2006 12:16 AM
Named ranges which seem to reference old workbooks/worksheets =?Utf-8?B?bWh1ZHNvbmFr?= Microsoft Excel Misc 2 11th Sep 2006 03:42 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Microsoft Excel Programming 0 21st Aug 2006 03:51 PM
Named Ranges - Slow Workbooks! Karl Burrows Microsoft Excel Programming 4 6th Apr 2004 07:19 PM
named ranges in other workbooks Mark Kubicki Microsoft Excel Misc 3 8th Oct 2003 10:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:08 PM.