Get sheet name from a named range's Name object

Shark picture Shark · Nov 14, 2011 · Viewed 24.3k times · Source

I have:

Microsoft.Office.Interop.Excel.Workbook wb;
Microsoft.Office.Interop.Excel.Name name;

Is there any way to get the worksheet name that the named range is on in the given workbook, assuming I've gotten the named range's Name object and wb already?

Answer

Raymond Hettinger picture Raymond Hettinger · Nov 14, 2011

Yes, use the Parent property to work your way up the object hierarchy:

ws = name.RefersToRange.Parent.name;