Internal URLs

  • Thread starter Thread starter Antony
  • Start date Start date
A

Antony

Hi,

I have a cell, that contains a reference to a document - i.e
C:\documents\test.doc - is there anyway that I can automatically convert
either by way of text recognition (ie the program recognises that is an
internal URL) or by way of cell reference (ie that whatever is in that cell
is an internal URL), so that when I type C:\ etc - it automatically creates
an internal hyperlink.

My email address is - myname at cdtoday.co.uk
--

thanks

Antony
(This email has been checked
by Norton Antivirus 2004)
 
Personally, I think I'd use a helper column with a bunch of formulas that refer
to the other cells.

=hyperlink(a13)
where a13 held the full filename.

Or you could do the typing yourself:
=hyperlink("c:\documents\test.doc")

Or put just the name of the file in A13, and the folder name in a1.

Then
=hyperlink($a$1&"\"&a13)

Then if/when the folder changes, you can just fix it in one spot.

But if you really wanted to have excel convert anything that looked like x:\
(letter, colon, backslash) to a hyperlink, you could use a worksheet event.

Right click on the worksheet tab that should have this behavior and select view
code. Paste this in the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub

With Target
If LCase(Left(.Value, 3)) Like "[a-z]:\" Then
Me.Hyperlinks.Add anchor:=.Item(1), Address:=.Value
End If
End With

End Sub

I limited my conversion range to column A.
 
Back
Top