简体   繁体   English

如何将单元格用于超链接目标/路径和工作簿名称 VBA?

[英]how to use cells for a Hyperlink destination/path and workbook name VBA?

I have a folder on the desktop我在桌面上有一个文件夹

C:\Users\ME\Desktop\folder1\folder2\

In workbook 1 have column A which was used to create folders within folder 2. Column N was then used to create filenames for each newly created workbook.在工作簿 1 中,A 列用于在文件夹 2 中创建文件夹。然后使用 N 列为每个新创建的工作簿创建文件名。

Every Row became a new workbook.每行成为一个新的工作簿。 (~3200 Workbooks, each in their own folder) (约 3200 个工作簿,每个都在自己的文件夹中)

How can I either write a VBA or a Formula to quickly create the hyperlinks.如何编写 VBA 或公式来快速创建超链接。 The reasoning is that the Master workbook will be used to narrow down the the search results and give immediate access to that location of the database.原因是主工作簿将用于缩小搜索结果的范围并立即访问数据库的该位置。

the path I have is,我的路径是,

C:\Users\ME\Desktop\folder1\folder2\ & Column A & "/" & Column N & ".xlsm"

I tried using a formula我尝试使用公式

=HYPERLINK('C':\Users\ME\Desktop\folder1\folder2\ & [@SITE] & "/" & [@FULLNAME] & ".xlsm",[@FULLNAME])

This doesn't seam to work, the Cells I'm referencing is stated as the column headers.这行不通,我引用的单元格被声明为列标题。 When I hit enter the entire column downward was then filled with "#NAME?"当我按下回车键时,整个列都向下填充了“#NAME?” and a error stating "the formula contains unrecognized text"和错误说明“公式包含无法识别的文本”

Flip "/" into a "\\"将“/”翻转为“\\”

Also look at this example for guidance:另请查看此示例以获取指导:

=HYPERLINK(C10&"\"&A10&"\"&B10&".xlsx")

也许在新列中使用这样的公式并将其用于整个范围:

=HYPERLINK("C:\Users\ME\Desktop\folder1\folder2\ & $A2 & "/" & $N2 & ".xlsm","PathToFile_" & $N2)

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

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