Lets say that I am in cell A1 and I have the following text:
Visit Google Group at http://groups.google.com every day
The ONLY think that I want hyperlinked is the actual URL of
http://groups.google.com and not the entire cell contents.
Any ideas?
Regards
BrianB
=====================================
goo...@totallynuts.org (Andrew) wrote in message news:<1e4db646.03050...@posting.google.com>...
In the cell I am looking for plain text AND a hyperlink.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
This will work for text, not formulas:
I put this in a cell:
Visit Google Group at http://groups.google.com every day
I highlighted http://groups.google.com and did format|cells.
I gave it an underline and blue font color.
Then I used the Drawing toolbar and dragged a Rectangle on top of that cell. I
held the alt-key and dragged by the corners to fill the cell exactly.
I rightclicked on the rectangle and chose Format autoshape. I made the
transparency 100%. I changed the color of the line (border) to "no Line".
I inserted this code into a general module.
Option Explicit
Sub jumptoHyperlink()
Dim myCell As Range
Dim httpPos As Long
Dim spacePos As Long
Dim myLink As String
Set myCell = ActiveSheet.Rectangles(Application.Caller).TopLeftCell
With myCell
httpPos = InStr(1, .Value, "http://", vbTextCompare)
If httpPos = 0 Then
Exit Sub
Else
spacePos = InStr(httpPos, .Value, " ")
If spacePos = 0 Then
spacePos = Len(.Value)
End If
myLink = Mid(.Value, httpPos, spacePos - httpPos + 1)
End If
End With
ThisWorkbook.FollowHyperlink Address:=myLink, NewWindow:=True
End Sub
Then I went back to my rectangle and rightclicked and assigned it this macro.
It uses the .topleftcell to get the value of the cell under it. So you can
assign this macro to as many rectangles as you want.
It does have to have something to pick out the link. I used http:// and the
trailing space (or end of value) to pick this one apart.
You might want to add ftp://, mailto:// and https:// into the mix.
--
Dave Peterson
ec3...@msn.com