Hyperlink Within Workbook Then Autozoom

  • I have a workbook that uses formulas to update hyperlinks (no VBA) to different areas in the workbook either on the same sheet or others in the workbook, the areas are described by volatile range names.


    I was hoping there was some VBA way to get the workbook to autozoom to the selected range when the hyperlink is activated.


    Any help appreciated.

  • Re: Hyperlink Within Workbook Then Autozoom


    Hi There Justin


    Try this code :


    Code
    Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
       
        ActiveWindow.Zoom = 200 ' set this to the % zoom you want
    
    
    End Sub


    If you need help on where to put this code just let me know.


    This should do what you are after :)

  • Re: Hyperlink Within Workbook Then Autozoom


    Hey there,


    Thankyou for the reply, I have tried that code (I found it during a search) but could not get it to work. I have placed it both in the individual worksheet code and in the THISWORKBOOK page but neither appears to work.


    Do I need to write the hyperlinks as macros in order for this method to work?

  • Re: Hyperlink Within Workbook Then Autozoom


    It should work. Don't see why it wouldn't. You are putting the code in the ThisWorkbook MODULE--correct?


    Quote from Justin Doward

    Hey there,


    Thankyou for the reply, I have tried that code (I found it during a search) but could not get it to work. I have placed it both in the individual worksheet code and in the THISWORKBOOK page but neither appears to work.


    Do I need to write the hyperlinks as macros in order for this method to work?

  • Re: Hyperlink Within Workbook Then Autozoom


    Hi MrkFrrl,


    I tested the code after using insert hyperlink and it works fine. The code does not work for the formula I am using eg =hyperlink(concatenate etc...)


    any ideas?

  • Re: Hyperlink Within Workbook Then Autozoom


    Copy your formulas with your macro recorder, if you need them to be variables at times. Then, while recording another macro, do a copy/paste-special/values to make your hyperlinks static. This would then be used immediately before the follow-hyperlinks macro is invoked.


    Mark

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!