Excel Macro executing Hyperlink shows 'Subscript out of range error'

大城市里の小女人 提交于 2019-12-25 18:35:54

问题


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.

来源:https://stackoverflow.com/questions/40660658/excel-macro-executing-hyperlink-shows-subscript-out-of-range-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!