This project has moved. For the latest updates, please go here.

copy worksheet with namedRanges

Nov 21, 2011 at 12:39 PM

I try to copy a worksheet with a namedRange with local scope.

I use the following code:

// 1. add a NamedRange on a sheet called "template": 
this.wrappedWorksheet.Range("$A$23:$XFD$23").AddToNamed(name, XLScope.Worksheet); 
// 2. copy the whole sheet 
// 3. finally delete the sheet called "template" 
The resulting workbook contains the named range with an invalid reference to "template!$A$23:$XFD$23".
I would expect the reference to be "newName!$A$23:$XFD$23".
I already tried to define a namedRange without the reference to the sheet (here: "$A$23:$XFD$23") but had no success.
Is there a way to create named ranges which can be copied together with the worksheet?