my hyperlink not work - Excel VBA

emilt_milut

New Member
Joined
Feb 4, 2018
Messages
9
Thank you for your time. I am a realbeginner in the VBA and I am asking for your help for the next issue.
I have <o:p></o:p>

A sheet called "START" in which anActiveX ComboBox named ”CLIENTI” is inserted,<o:p></o:p>
and<o:p></o:p>
A sheet called "CLIENTI" in whichthe Range ”B3:B100” contain hyperlink addresses to various Workbooks<o:p></o:p>
ListFillRange – ”CLIENTI!B3: B100”<o:p></o:p>
LinkedCell – ”CLIENTI!A3”<o:p></o:p>
Sheet files in the list of"CLIENTI" are located in C:\DIANA\TRAD\clienti\<o:p></o:p>
I want to open the selected file from ComboBoxby activating the hyperlink<o:p></o:p>
I wrote thefollowing procedure, but it does not work.<o:p></o:p>
Sub Open_pg_client()<o:p></o:p>
'<o:p></o:p>
' Open_pg_client Macro<o:p></o:p>
' Range("J3")=CONCATENATE(G3;A1;H3)<o:p></o:p>
' Range("G3")= file:///C:\DIANA\TRAD\clienti\<o:p></o:p>
' Range("A1") = LinkedCell<o:p></o:p>
' Range("H3") = .xlsx<o:p></o:p>
' Range("K3")=contain the value of Range("J3")<o:p></o:p>
' Range("M5")= HYPERLINK($K$3)<o:p></o:p>
Sheets("CLIENTI").Select<o:p></o:p>
Range("J3").Select<o:p></o:p>
Application.CutCopyMode = False<o:p></o:p>
Selection.Copy<o:p></o:p>
Range("K3").Select<o:p></o:p>
Selection.PasteSpecialPaste:=xlPasteValues, Operation:=xlNone, SkipBlanks _<o:p></o:p>
:=False, Transpose:=False<o:p></o:p>
<o:p></o:p>
Sheets("CLIENTI").Range("M5").Hyperlinks(2).Follow<o:p></o:p>
<o:p> </o:p>
If GetUserAddress = True Then<o:p></o:p>
MsgBox "Successfullyfollowed hyperlink."<o:p></o:p>
Else<o:p></o:p>
MsgBox "Could not followhyperlink."<o:p></o:p>
End If<o:p></o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
I get the errormessage:<o:p></o:p>
”Run-time error ”9”:<o:p></o:p>
Subscript Out of Range”<o:p></o:p>
Thank you in advance for any help.<o:p></o:p>
Kind Regards<o:p></o:p>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi

Your routine appears to be copying a link into cell K3 from J3, but then referencing it in M5, wasn't sure that was what you intended?

But any way, the copied data is just a reference in text to a path (and not a hyperlink), so if you change "Sheets("CLIENTI").Range("M5").Hyperlinks(2).Follow" to "ActiveWorkbook.FollowHyperlink Address:=Range("K3").Value" (referencing cell K3, or if you do need it to refer to M5 - you just need to change the reference), this should then work (does in my test file anyway!)

regards
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,198
Members
453,022
Latest member
RobertV1609

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