简体   繁体   English

Excel超链接和VBA

[英]Excel Hyperlinks and VBA

I have a Data Validation list 我有数据验证列表

在此处输入图片说明

which refer to my various worksheets 参考我的各种工作表

在此处输入图片说明

I would like to be able to select the worksheet I wish to view / jump to and use a VBA button to take me to that worksheet. 我希望能够选择要查看/跳转到的工作表,并使用VBA按钮将我转到该工作表。

Is this possible please? 请问这可能吗?

PS: I would like a single button to go to the sheet selected from the dropdown PS:我希望一个按钮可以转到从下拉列表中选择的工作表

In the VBA Project window double click the Worksheet that has your validation list. 在“ VBA项目”窗口中,双击包含您的验证列表的工作表。 This will open the that Worksheet's code module. 这将打开该工作表的代码模块。 Paste this code and change Range("E1") to the correct cell address. 粘贴此代码,并将Range(“ E1”)更改为正确的单元格地址。

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not Intersect(Taget, Range("E1")) Is Nothing Then
        On Error Resume Next
            Sheets(Range("E1").Text).Select
        On Error GoTo 0
    End If

End Sub

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM