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.
我在excel工作,我想从页面顶部到页面上的另一个位置创建一个Hyper Link。
I type in a box at the top, and then right link and go down to hyper link
in the dropdown menu I click it and select the tab that says "In This Work Book" and change it to where I want it to go. So all this is good and all but my Question is:
我在顶部输入一个框,然后右键链接并在下拉菜单中转到超链接我单击它并选择“在此工作簿中”选项卡并将其更改为我想要的位置。所以这一切都很好,除了我的问题之外的所有问题是:
Can I make a Hyper link to bring me to a cell and scroll the window so the selected cell is the first row, instead of being near the bottom of the window?
我可以创建一个Hyper链接将我带到一个单元格并滚动窗口,以便所选单元格是第一行,而不是靠近窗口的底部吗?
Example:
Hyper link: "Test" Located in Cell A,1
超链接:“测试”位于单元格A中,1
Location Of Hyper Link: A,210
超链接的位置:A,210
Now instead of having it put A,210 at the very Bottom and show the cells above it, I want to to be at the top and show the cells below it.
现在,我没有将A,210放在最底层并显示其上方的单元格,而是希望它位于顶部并显示其下方的单元格。
Thanks for the help,
谢谢您的帮助,
1 个解决方案
#1
7
Add the following VBA code to your worksheet:
将以下VBA代码添加到工作表中:
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).
您必须将代码保存为xlsm文件,以便启用宏。使用Alt-F-11打开VBA编辑器,以便实际添加代码(双击左侧窗格中的工作表,然后将上面的代码粘贴到打开的窗口中)。
#1
7
Add the following VBA code to your worksheet:
将以下VBA代码添加到工作表中:
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).
您必须将代码保存为xlsm文件,以便启用宏。使用Alt-F-11打开VBA编辑器,以便实际添加代码(双击左侧窗格中的工作表,然后将上面的代码粘贴到打开的窗口中)。