Linking a cell with a worksheet?

Jan 4, 2011 at 8:41 PM

I did some searching on this and didn't turn up anything. What I would like to do is link a cell with a spreadsheet in the same workbook. This is easy to achieve in Interop with something like this:

ws.Hyperlinks.Add(ws.Cells[1, 1], "", "someworksheet!A1", Type.Missing, dataToDisplay);

I see that ExcelRange has a Hyperlink property, but I don't see how to use it to link between worksheets. Maybe it's just something I'm overlooking?


Jan 5, 2011 at 7:41 AM


Look at sample 6 or on the home page, content sheet link.

Looks like this...

 //Add a HyperLink to the statistics sheet. 
var namedStyle = pck.Workbook.Styles.CreateNamedStyle("HyperLink");   //This one is language dependent
namedStyle.Style.Font.UnderLine = true;
ws.Cells["K12"].Hyperlink = new ExcelHyperLink("Statistics!A1", "Statistics");
ws.Cells["K12"].StyleName = "HyperLink";



Jan 5, 2011 at 7:14 PM

Perfect, just what I was looking for! Thanks, and thanks again for this fantastic framework, Jan!