Excel 超链接 - 跳转到单元格和滚动窗口 [英] Excel Hyperlink - jump to cell and scroll window

查看:31
本文介绍了Excel 超链接 - 跳转到单元格和滚动窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Excel 中工作,我想创建一个从页面顶部到页面上另一个位置的超链接.

我在顶部的框中输入一个框,然后在下拉菜单中向右链接并向下转到 hyper link 我单击它并选择显示在此工作簿中"的选项卡并更改它到我想要它去的地方.所以这一切都很好,但我的问题是:

<块引用>

我可以创建一个超链接,将我带到一个单元格并滚动窗口,使选定的单元格成为第一行,而不是靠近窗口底部吗?

示例:

超链接:测试"位于单元格 A,1

超链接位置:A,210

现在,与其将 A,210 放在最底部并显示其上方的单元格,不如将其放在顶部并显示其下方的单元格.

感谢您的帮助,

解决方案

将以下 VBA 代码添加到您的工作表:

私有子工作表_FollowHyperlink(ByVal Target As Hyperlink)ActiveWindow.ScrollRow = ActiveCell.Row结束子

神奇的是,当您单击链接时,该单元格将位于顶部.如果您不希望所有链接都出现这种行为,您可以测试 Target 地址.

您必须将代码保存为 xlsm 文件,以便启用宏.使用 Alt-F-11 打开 VBA 编辑器,以便您可以实际添加代码(双击左侧窗格中的工作表,然后将上述代码粘贴到打开的窗口中).

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 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?

Example:

Hyper link: "Test" Located in Cell A,1

Location Of Hyper Link: 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.

Thanks for the help,

解决方案

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).

这篇关于Excel 超链接 - 跳转到单元格和滚动窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆