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

NamedRange

Mar 20, 2014 at 10:25 AM
Hi,

I am trying to copy a worksheet from one workbook to another. But it is not copying the named ranged to new sheet (IXLNamedRange)

I have tried using the below code, but showing error for some ranges

foreach (IXLNamedRange namedRange in srcBook.NamedRanges) {
foreach (IXLRange range in namedRange.Ranges) {
  destBook.NamedRanges.Add(namedRange.Name, range);
}
}

I am getting the error as "Sequence contains no matching element".

Thanks in advance.