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
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
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:

emilt_milut

New Member
Joined
Feb 4, 2018
Messages
9
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…….
 

emilt_milut

New Member
Joined
Feb 4, 2018
Messages
9
I think it's pretty simple, but not for me!:) Where can I find information on this topic?
 

emilt_milut

New Member
Joined
Feb 4, 2018
Messages
9
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,273
Messages
5,527,712
Members
409,784
Latest member
AdamPriest

This Week's Hot Topics

Top