Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

copy worksheets between workbooks - including named ranges

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
christian_spaceman - 20 Dec 2007 12:11 GMT
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
Bob Phillips - 20 Dec 2007 12:55 GMT
Isn't that its default behaviour?

Signature

---
HTH

Bob

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

> Hi,
>
[quoted text clipped - 26 lines]
>
> Chris
christian_spaceman - 20 Dec 2007 13:05 GMT
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.

> Isn't that its default behaviour?
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.