ajetrumpet
Banned
- Local time
- Yesterday, 18:21
- Joined
- Jun 22, 2007
- Messages
- 5,638
Here is a quick way to turn a cell's string into a hyperlink with Excel VBA:
I had to do this once from an online PHP report that I copied into Excel. The hyperlinks from the browser copied as strings, so this function changed them accordingly:
PHP:
Range(CELLNAME).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=THE ADDRESS, _
TextToDisplay:=LINK TEXT
PHP:
Sub Rearrange()
Dim r As Range
Dim myvalue As String
For Each r In Range("a1", Range("a1").End(xlDown))
If InStr(r, "http://") > 0 Or InStr(r, "www.") > 0 Then
myvalue = r.Value
Range(r.Address).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=myvalue, _
TextToDisplay:=myvalue
End If
Next r
Range("a1").Select
End Sub