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开发者_Python百科 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.
Simply do:
Excel.Range range = myWorksheet.get_Range("MyName", Type.Missing);
精彩评论