Need syntax for adding a hyperlink thru VBA

Drdave1958

Board Regular
Joined
Mar 10, 2002
Messages
204
Here's what I got...

code:
Sub TestHyper()
myfile = "Daves.jpg"
mylink = "DavesLink"
Path = "(\\Servername\Foldername\"
ActiveCell.Hyperlink.Add Path & myfile & mylink
End Sub

I've searched the site and the help file but I'm still going in circles. Will someone steer me in the right direction?

Thanks, Dave
 
I need to set internal links between cells. Is there a "HYPERLINK" type formula that does this?

I am actually looking for the same thing.
ActiveCell.Hyperlinks.Add Range("RangeName1"), Range("RangeName2")

I get a type mismatch on the second RangeName. RangeName2 is simply a rangename in the current worksheet that I want to jump to. I am sure it is simple. I just can't find the syntax.

Thanks,
Dave
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I am actually looking for the same thing.
ActiveCell.Hyperlinks.Add Range("RangeName1"), Range("RangeName2")

I get a type mismatch on the second RangeName. RangeName2 is simply a rangename in the current worksheet that I want to jump to. I am sure it is simple. I just can't find the syntax.

Thanks,
Dave


Try this:
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= "'YourSheetName'!YourCellAddres" , TextToDisplay:="YourTextHere"

You can also pass the SubAddress as a string variable:

Dim SubAdd as String

SubAdd = "'" & Sheets(1).Name & "'" & EnterYourCellAddressHere


If you were going to add these hyperlinks to worksheets a lot, I would suggest creating a form to input the information and pass it into the macro.
 
Upvote 0
hi,

I want a formula which would do the following:
Matching the date (column B) with that in row H2 onwards, and then it will match the names written in column C with names in column H
and after matching these conditions, the hyperlink will connect to name in column H

please help!!!!
 
Upvote 0

Forum statistics

Threads
1,215,898
Messages
6,127,633
Members
449,392
Latest member
Kersh82

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