![Excel:如何创建搜索栏以便我进行搜索并将我发送到特定选项卡](https://linux22.com/image/1534415/Excel%EF%BC%9A%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E6%90%9C%E7%B4%A2%E6%A0%8F%E4%BB%A5%E4%BE%BF%E6%88%91%E8%BF%9B%E8%A1%8C%E6%90%9C%E7%B4%A2%E5%B9%B6%E5%B0%86%E6%88%91%E5%8F%91%E9%80%81%E5%88%B0%E7%89%B9%E5%AE%9A%E9%80%89%E9%A1%B9%E5%8D%A1.png)
我有一个包含 150 多个标签的主 Excel 表。我正在尝试创建一个搜索栏,以便我能够按字母顺序轻松查看这些命名的标签,并在单击后将我带到这些标签。
答案1
我将使用以下 VBA 代码在名为“索引”的新工作表中创建选项卡名称列表作为超链接,然后手动对其进行排序。
Sub generate_DOWN_list_with_hyperlinks_of_sheets_in_the_Active_Workbook()
Dim ws As Worksheet
If MsgBox("Do you want to create a list, starting in the active cell, of all sheets in this work book?", vbYesNo) = vbNo Then Exit Sub
For Each ws In ActiveWorkbook.Worksheets
'insert name
ActiveCell.Value = ws.Name
'insert hyperlink
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:="'" & ws.Name & "'!A1", _
TextToDisplay:=ws.Name
ActiveCell.Offset(1, 0).Activate
Next ws
End Sub