Public Sub Make_Buttons()
Dim oActive As Worksheet
Dim oLinks As Range
Dim oCell As Range
Dim oOffset As Range
Dim oLink As Hyperlink
Dim oButton As Shape
Dim strFormula As String
Dim strLink As String
Dim strFriendly As String
Dim REX As Object ' RegExp
Set oActive = ActiveSheet
Set oLinks = Range("A1:A10")
'=HYPERLINK("http://www.cpearson.com/excel/","Chip's")
Const PATTERN_LEFT As String = "=HYPERLINK\("""
Const PATTERN_RIGHT As String = ","""
Set REX = CreateObject("VBScript.RegExp")
With REX
.Global = False
.IgnoreCase = True
End With
For Each oCell In oLinks
If oCell.HasFormula Then
If oCell.Formula Like "=HYPERLINK(*" Then
strFormula = oCell.Formula
REX.Pattern = PATTERN_LEFT
strLink = REX.Replace(strFormula, "")
strFriendly = Mid(strLink, InStr(1, strLink, PATTERN_RIGHT) + 2, 255)
strFriendly = Left(strFriendly, Len(strFriendly) - 2)
strLink = Mid(strLink, 1, InStr(1, strLink, PATTERN_RIGHT) - 2)
Set oOffset = oCell.Offset(0, 1)
Set oButton = oActive.Shapes.AddShape(msoShapeRectangle, oOffset.Left + 2, oOffset.Top + 2, oOffset.Width - 4, oOffset.Height - 4)
With oButton
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Line.ForeColor.RGB = RGB(0, 0, 0)
'// not sure why problems here, I'm in 2000 and intellisense was showing?
'// un-comment the next two lines if they were working w/o error
'.TextFrame.Characters.Font.ColorIndex = 0
'.TextFrame.Characters.Font.Size = 8
.TextFrame.Characters.Text = strFriendly 'oCell.Hyperlinks(1).TextToDisplay
.Line.Style = msoLineThinThin
'Adjust additional properties for desired appearance
End With
oActive.Hyperlinks.Add Anchor:=oButton, Address:=strLink ', TextToDisplay:=strFriendly
End If
End If
Next
End Sub