Run-time error ”9”:Subscript Out of Range VBA - Excel 2016

emilt_milut

New Member
Joined
Feb 4, 2018
Messages
9
Thank you for your time. I am a real beginner in the VBA and I am asking for your help for the next issue.
I have
A sheet called "START" in which an ActiveX ComboBox named ”CLIENTI” is inserted,
and
A sheet called "CLIENT" in which the Range ”B3:B100” contain hyperlink addresses to various Workbooks
ListFillRange – ”CLIENTI!B3: B100”
LinkedCell – ”CLIENTI!A3”
Sheet files in the list of "CLIENTI" are located in C:\DIANA\TRAD\clienti\
I want to open the selected file from ComboBox by activating the hyperlink
I wrote the following procedure, but it does not work.
Sub Open_pg_client()
'
' Open_pg_client Macro
' Range("J3")=CONCATENATE(G3;A1;H3)
' Range("G3")= file:///C:\DIANA\TRAD\clienti\
' Range("A1") = LinkedCell
' Range("H3") = .xlsx
' Range("K3")=contain the value of Range("J3")
' Range("M5")= HYPERLINK($K$3)
Sheets("CLIENTI").Select
Range("J3").Select
Application.CutCopyMode = False
Selection.Copy
Range("K3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Sheets("CLIENTI").Range("M5").Hyperlinks(2).Follow

If GetUserAddress = True Then
MsgBox "Successfully followed hyperlink."
Else
MsgBox "Could not follow hyperlink."
End If
End Sub

I get the error message:
”Run-time error ”9”:
Subscript Out of Range”
Thank you in advance for any help.
Kind Regards
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Subscript out of range also occurs when a sheet name does not exist, e.g. Referring to Sheet2 in VBA when only Sheet1 exists.

Not saying this is the answer but check that all the spreadsheets you're referring to actually exist so you can eliminiate this possibility.
 
Last edited:
Upvote 0
Thank you very much for your answer!<o:p></o:p>
I haveonly 2 Sheets in my Workbook, first named START (where is located the ComboBox)and second named CLIENTI.

There was an error in my post.
Wrong
A sheet called "CLIENT" in which the…….

Correct
A sheet called "CLIENTI" in which the…….
 
Upvote 0
Thank you for your response and time. No, I did not solve the problem.
I will try to find the solution in the link you posted.
All the best regards!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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