The GetURL User Defined Formula is for a webpage URL
For a worksheet see Bill Manville's solution
in
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
that he posted 2002-07-26, covers Excel links as well,
and is only for object type hyperlinks. But you can use it
for webpage URL or for references to cells.
Function HyperLinkText(oRange As Range) As String
Dim ST1 As String, ST2 As String
If oRange.Hyperlinks.Count = 0 Then Exit Function
ST1 = oRange.Hyperlinks(1).Address
ST2 = oRange.Hyperlinks(1).SubAddress
If ST2 <> "" Then ST1 = "[" & ST1 & "]" & ST2
HyperLinkText = ST1
End Function
The result will look like this:
[]Sheet2!D3
which is really [ ]Sheet2!D3 and not showing the
workbookname.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
Gord Dibben said:
Dave
This UDF returns nothing when hyperlink is to a second sheet in same workbook.
Any way to alter?
Gord Dibben Excel MVP