Excel Hyperlink - jump to cell and scroll window

前端 未结 1 968
轻奢々
轻奢々 2021-01-01 06:08

I am working in excel and I want to make a Hyper Link from the top of the page to another location on the page.

I type in a box at the top, and then right link and g

相关标签:
1条回答
  • 2021-01-01 06:47

    Add the following VBA code to your worksheet:

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        ActiveWindow.ScrollRow = ActiveCell.Row
    End Sub
    

    By magic, when you click a link, that cell will be at the top. If you don't want this behavior for all links, you can test the Target address.

    You will have to save the code as a xlsm file so that macros are enabled. Use Alt-F-11 to open the VBA editor so you can actually add the code (double click the worksheet in the left hand pane, then paste the above code in the window that opens).

    0 讨论(0)
提交回复
热议问题