# Click excel hyperlink with vba



## rslc (Aug 24, 2007)

I have a excel hyperlink that is generated by code and i want to be able to click the link with vba or a macro and follow it. I have tried recording a macro but it follows to a specific cell and as the hyperlink address keeps changing this doesn't work

thanks
rslc


----------



## David M58 (May 20, 2008)

For example, if cell A1 contains one hyperlink that points to http://www.google.com/, you can then launch Google in your browser with this statement:

Range("A1").Hyperlinks(1).Follow


----------



## rslc (Aug 24, 2007)

Thanks for the reply but the link i want to click points to an excel cell on another worksheet that i want to go to and using your code results in hi-lighted error in vba code module


----------



## David M58 (May 20, 2008)

You may find it necessary to specify additional qualifiers, such as the worksheet name in this line:
Worksheets("Sheet1").Range("A1").Hyperlinks(1).Follow
This may take some experimentation with the _Follow_ method of the _Hyperlink_ object.


----------

