Excel Macro executing Hyperlink shows 'Subscri

2019-09-06 03:10发布

问题:

My spreadsheet generates dynamic hyperlinks based om car license numbers. If I click them I got access to an internet database. Cell is built with 'Concatenate' function.

Sub Macro10()

ActiveSheet.Unprotect Password:=""
Range("a1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveSheet.Protect Password:=""
End Sub

If I run this macro on a fresh typed in cell, it works. If I run it based on the concatenate cell I receive message 'Subscript out of range error'. Even when I run it by using a cell reference in A1 like '=D15' I receive same message. Apparently cell content is not recognized as a hyperlink although the manual process does.

Also, when I record a macro based on steps I do manually, it shows similar message.

I have no idea to solve this problem. Maybe someone has ?

Thanks, Dennis

Added:

Link building:

HYPERLINK(CONCATENATE("ovi.rdw.nl/… link") Cell G11 contains a car license number like 49-KNL-6.

Note: please hover the ovi link to see exact link building. Sorry, don't know how to write better.

As I said before, within the spreadsheet link works fine, but I cannot have it work properly through a macro. I need this macro as it should temporarily remove sheets password.