Let's say that I type Splicing into the cell. I want to be able to set it up so the cell auto links the Splicing word so when you click on it, it takes you to the search engine and searches for Splicing.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler
If Target.Address = Range("A1").Address Then
ThisWorkbook.FollowHyperlink _
"http://www.google.com/search?q=" & Target
End If
ErrHandler:
MsgBox Err.Description
End Sub
Private oTarget As Range
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
If Not IsEmpty(Target) Then
Set oTarget = Target
Application.OnTime Now + TimeSerial(0, 0, 1), _
Me.CodeName & ".AddHyperlink"
End If
End If
End Sub
Private Sub AddHyperlink()
On Error GoTo ErrHandler
With oTarget
Hyperlinks.Add Anchor:=oTarget, Address:= _
"http://www.google.com/search?q=" & .Text, _
TextToDisplay:=.Text
End With
Set oTarget = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub