Sub ConvertHyperlinks()
'David McRitchie, misc, 2000-01-17, misc
'[URL unfurl="true"]http://www.mvps.org/dmcritchie/excel/buildtoc.htm[/URL]
Dim cell As Range
Dim hyperlinkaddress As String, hyperlinkformula As String
For Each cell In Selection
On Error GoTo skipHyper
hyperlinkaddress = cell.Hyperlinks(1).Address
On Error GoTo 0
If hyperlinkaddress = "" Then GoTo skipHyper
hyperlinkformula = cell.Formula
If Left(hyperlinkformula, 1) = "=" Then
hyperlinkformula = Right(hyperlinkformula, Len(hyperlinkformula) - 1)
Else
hyperlinkformula = Replace(hyperlinkformula, """", """""")
hyperlinkformula = """" & hyperlinkformula & """"
End If
cell.Formula = "=HYPERLINK(""" & hyperlinkaddress & _
"""," & hyperlinkformula & ")"
skipHyper: On Error GoTo 0
Next cell
On Error GoTo 0
Selection.Hyperlinks.Delete
For Each cell In Selection
cell.Formula = cell.Formula
Next cell
End Sub