vba 通过文本自动创建到另一个工作表的超链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10130040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Automatically creating hyperlink to another sheet by text
提问by dirtyw0lf
I would like to know how to create a hyperlink from one excel sheet to another, automatically through a script, based on equal text values that both cells in their respective sheets have.
我想知道如何根据各自工作表中的两个单元格具有的相等文本值,通过脚本自动创建从一个 Excel 工作表到另一个 Excel 工作表的超链接。
If this can be done without a script, using a formula of some kind (like VLOOKUP) this would be preferable.
如果这可以在没有脚本的情况下完成,使用某种公式(如 VLOOKUP)这将是可取的。
thanks for your time.
谢谢你的时间。
回答by Jerry Beaucaire
- Hyperlink on same sheet using a value in A1:
- 使用 A1 中的值在同一工作表上的超链接:
=HYPERLINK("#" & ADDRESS(MATCH(A1, B1:B5, 0), 2), "Link")
=超链接(“#”和地址(匹配(A1,B1:B5,0),2),“链接”)
- Hyperlink to a specific different sheet using a value in A1:
- 使用 A1 中的值超链接到特定的不同工作表:
=HYPERLINK("#'My Database'!" & ADDRESS(MATCH($A1, 'My Database'!$A:$A, 0), 1), "Link")
=HYPERLINK("#'My Database'!" & ADDRESS(MATCH($A1, 'My Database'!$A:$A, 0), 1), "Link")
- Hyperlink to a sheet listed in cell A1
- 超链接到单元格 A1 中列出的工作表
=HYPERLINK("#'" & A1 & "'!A1", "Link")
=HYPERLINK("#'" & A1 & "'!A1", "链接")
- Hyperlink to a random position in a column that must be found on a random sheet listed in cell C3, matching the value in A1, a 3D INDEX/MATCH/Hyperlink:
- 超链接到列中的随机位置,必须在单元格 C3 中列出的随机工作表上找到,匹配 A1 中的值,3D INDEX/MATCH/超链接:
=HYPERLINK("#" & CELL("address", INDEX(INDIRECT(C3 & "!A:A"), MATCH(A1, INDIRECT(C3 & "!A:A"), 0))), "Link")
=HYPERLINK("#" & CELL("地址", INDEX(INDIRECT(C3 & "!A:A"), MATCH(A1, INDIRECT(C3 & "!A:A"), 0))), "链接”)
There's a sample sheet found here where you can see these applied: 3D Hyperlink Examples
这里有一个示例表,您可以在其中看到这些应用: 3D 超链接示例