hyperlink to button

EDUCATED MONKEY

Board Regular
Joined
Jul 17, 2011
Messages
218
I have created the hyperlink/links no problem instead of a clickable link in a cell I would like to have a button is the a way to call the excell =hyperlink function, at present the excel formula is =HYPERLINK(O2,D2)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Where O2 is the text to be converted and D2 the friendly name, which I would like to pass to the buttons caption property, I have looked all over the place for vba code to do this but only found cod to creat the hyperlink which I allready have <o:p></o:p>
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Check out the ActiveWorkbook.FollowHyperlink Method.

Below are three examples that show:
1. Hyperlink directly to a filepath
2. Hyperlink to a URL address
3. Hyperlink to an indirect address (similar to your current worksheet formula).

Rich (BB code):
Private Sub CommandButton1_Click()
    ActiveWorkbook.FollowHyperlink Address:="C:\TEST\MyFile.pdf"
End Sub
 
Private Sub CommandButton2_Click()
    ActiveWorkbook.FollowHyperlink Address:="http://www.mrexcel.com/forum/", _
        NewWindow:=True
End Sub
 
Private Sub CommandButton3_Click()
    ActiveWorkbook.FollowHyperlink Address:=Sheets("Sheet1").Range("D2").Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top