views:

48

answers:

1

I have an excel worksheet with various names and I want to create an object that references that name. The code I am working with uses the cell address, but that is very cumbersome, and I would rather use the names.

My code looks like this right now:

myWorksheet= GetWorkSheet(myWorkbook);
Excel.Range range = myWorksheet.get_Range(cell1, cell2);

Instead of using cell1 and cell2, I would like to use the name that is in Excel already that describes the range.

Thanks for your help.

+1  A: 

Simply do:

Excel.Range range = myWorksheet.get_Range("MyName", Type.Missing);
Mathias
Thanks, I'll try that.
msgisme