View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Converting a value in a cell to a hyperlink in the same cell via V

I turned on the macro recorder and then inserted a hyperlink. Turned off the
recorder and looked at the code
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 07/26/2006 by OGILVTW
'

'
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"http://www.cpearson.com/excel/duplicat.htm", TextToDisplay:= _
"http://www.cpearson.com/excel/duplicat.htm"
End Sub

this would tell me

Sub MakeHyperlink()
Range("B10").Hyperlinks.Add Anchor:=Range("B10"), _
Address:=Range("B10").Value, _
TextToDisplay:=Range("B10").Value

End Sub

which worked for me.


--
Regards,
Tom Ogilvy



"Sandy" wrote:

I have a path to a file in cell B10. I want cell b10 to be converted to a
hyperlink without needing to point to a different cell (which I can do with
the worksheet HYPERLINK function.

I want to do this programmatically via VB.

I have searched prior hyperlink questions and answers on this site but have
found my case.

Thanks,

Sandy