How to get Named range data

Oct 29, 2012 at 6:38 PM
Edited Oct 29, 2012 at 6:50 PM

I realize this may not be the right place to post this question but please reply back if have done something like this before.

All I want is to get the ranges (R&C) that name refers to.

Names n = activeWorkbook.Names;

foreach (Name nm in n)
{
 object[,] data;
 Range range = nm.RefersToRange;
 data = range.Value;

}

The issue here is data contains only single column, where as in actual it the name refers to 2 columns.

What is the best way to solve this.

Here are references I was looking at but couldnt find a good solution.

http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/6d0773f7-02c4-4c82-8722-a7a77dd193e9/

http://bishoponvsto.wordpress.com/2009/09/01/reading-named-ranges-in-excel-using-c/

Thanks,
-A