hyperlink.add in another sheet

New Contributor

Hi I hope this is the right place. We have a bit of code is causing an issue in new versions of Excel. It's a pretty simple hyperlink.add. 

I have a machine with Excel 2016 1607 build and it works fine on there. But on a machine with Excel 2016 1708 that we've just installed (and I tried another with the same build) the code doesn't work the same. 


It is supposed to add a hyperlink on another sheet, what it does is add the hyperlink, but the formatting for that link gets applied to whichever cell you was on when you was last on that sheet. 

If that sheet is open when the code runs it all works as expected, it's just if the code runs while another sheet is open (which is what we want). 


For Example

I work on SheetB in cell A9

I then go to SheetA

While on SheetA I click the button that runs code that adds a hyperlink to SheetB on cell A1

What happens is: SheetB CellA1 gets a hyperlink added but is still black with no underline, and cell A9 is blue and underlined. 



Can anyone shed any light on why this has changed between versions? Coincidentally https://msdn.microsoft.com/en-us/vba/excel-vba/articles/hyperlinks-add-method-excel was updated in June but I can't see anything there that explains it!


many thanks,


0 Replies