提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中一次更改多个超链接路径?

出于某种目的,您可以在工作表中为您的值创建多个超链接,并且所有超链接都链接到相同的文件路径或地址,但现在,您需要一次将此超链接路径替换为另一个地址。 单独更改超链接的路径可能会浪费大量时间,是否有快速解决此问题的方法?

使用VBA代码一次更改多个超链接路径

使用Kutools for Excel从超链接中提取实际地址

使用Kutools for Excel删除选择/工作表/工作簿中的所有超链接


从超链接中提取/显示真实地址:

您订购的 Kutools for Excel 转换超链接,您可以立即从超链接的单元格中快速提取真实的URL地址。

doc从超链接中提取地址


箭头蓝色右泡 使用VBA代码一次更改多个超链接路径


假设您的数据列表具有与以下屏幕截图相同的超链接,并且使用VBA代码,则可以快速替换旧文件路径或新地址。

DOC-变化hyperlinks1

1. 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

2. 点击 插页 > 模块,并粘贴在下面的宏 模块窗口.

VBA代码:一次更改多个超链接路径

Sub ReplaceHyperlinks()
'Updateby20140220
Dim Ws As Worksheet
Dim xHyperlink As Hyperlink
Dim xOld As String, xNew As String
xTitleId = "KutoolsforExcel"
Set Ws = Application.ActiveSheet
xOld = Application.InputBox("Old text:", xTitleId, "", Type:=2)
xNew = Application.InputBox("New text:", xTitleId, "", Type:=2)
Application.ScreenUpdating = False
For Each xHyperlink In Ws.Hyperlinks
    xHyperlink.Address = Replace(xHyperlink.Address, xOld, xNew)
Next
Application.ScreenUpdating = True
End Sub

3。 然后按 F5 键运行此代码,并提示框让您输入旧的超链接地址 旧文本 框。 看截图:

DOC-变化hyperlinks2

4。 点击 OK,并弹出另一个提示框来提醒您输入您要使用的新超链接地址。

DOC-变化hyperlinks3

5。 然后点击 OK,所有旧的超链接地址一次被新的地址替换。 查看屏幕截图:

DOC-变化hyperlinks4 -2 DOC-变化hyperlinks5

箭头蓝色右泡 使用Kutools for Excel从超链接中提取实际地址

如果你想从Excel中的超链接中提取实际的地址,你怎么办? 同 转换超链接 of Kutools for Excel,你可以快速处理这个任务。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

如果你有 Kutools for Excel,请按照以下步骤操作:( 免费下载Kutools for Excel

1。 点击 Kutools > 链接 > 转换超链接,看截图:

DOC-变化hyperlinks5

2。 在 转换超链接 对话框中选择 超链接地址替换单元格内容 选项下 转换类型 部分,然后单击第一个 doc更改超链接8 按钮选择要提取实际地址的超链接范围,单击第二个 doc更改超链接8按钮选择要放置结果的单元格,请参阅截图:

DOC-变化hyperlinks5

3。 然后点击 OK 按钮,并从所选超链接中提取所有实际地址,请参阅屏幕截图:

DOC-变化hyperlinks5

点击了解更多关于此转换超链接功能。

免费下载Kutools for Excel


箭头蓝色右泡 使用Kutools for Excel删除选择/工作表/工作簿中的所有超链接

许多超链接需要从工作表或工作簿中删除, Kutools for Excel删除超链接 函数可以帮助您删除工作簿中一个或多个工作表中选定范围内的超链接。

安装后 Kutools for Excel,请做这个:( 免费下载Kutools for Excel

点击 Kutools > 链接 > 删除超链接,然后选择要删除超链接的范围,请参阅截图:

DOC-变化hyperlinks5

点击了解更多关于删除超链接功能。

免费下载Kutools for Excel


相关文章:


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    wannabeIT · 3 months ago
    Had a spreadsheet with over 200 items that had hyperlinks that needed to be edited. This just saved me SO MUCH TIME. THANK YOU!!
  • To post as a guest, your comment is unpublished.
    Lona · 1 years ago
    I need to only get part of my text in the hyperlinks removed.
  • To post as a guest, your comment is unpublished.
    Taylor · 1 years ago
    For some reason, these macros have quit working recently. I have used them multiple times to fix issues on many spreadsheets but now it doesn't do anything. No errors just no corrections
    • To post as a guest, your comment is unpublished.
      Jafedi · 3 months ago
      I´m the same problem. What´s the reason?
  • To post as a guest, your comment is unpublished.
    Fabio · 1 years ago
    Wow, thanks. Its amazing that Excel doesn't have a solution for cases like this.
  • To post as a guest, your comment is unpublished.
    Vern · 2 years ago
    Sorry, nevermind about my question, I stumbled on my answer. I exited out of the macro editor, placed my cursor in cell A1 of the worksheet I wanted to edit and ran the macro and Boom all the links were changed! Thanks so much!
  • To post as a guest, your comment is unpublished.
    Vern Poplaski · 2 years ago
    I loaded the hyperlink change macro and ran it. It worked but only on the active cell. How do you get it to go through the entire worksheet?
  • To post as a guest, your comment is unpublished.
    Hannes · 2 years ago
    I have a spreadsheet with thousands of links to scanned images on a Google Drive folder. When Excel crashes, it decides to change all my hyperlinks and have it point at a APP ROAMING directory. It took me less than 15 minutes to fix all links. You are the best !!!!
  • To post as a guest, your comment is unpublished.
    pranav · 2 years ago
    great help. the code helped me mass update hyperlinks in a minute.

    thanks a ton
    Pranav
  • To post as a guest, your comment is unpublished.
    Tom · 2 years ago
    Amazing - thanks v much, this just saved me a load of manual editing after a spreadsheet of mine crashed and recovered but with corrupted hyperlinks
  • To post as a guest, your comment is unpublished.
    Diishaa · 2 years ago
    How would I change this in order to update hyperlinks that link to folders within a hard drive rather than external web addresses?
  • To post as a guest, your comment is unpublished.
    Diishaa · 2 years ago
    I tried to run it on hyperlinks that contains other folders reference but it didn't work.
    How would I change this in order to update hyperlinks that link to folders within a hard drive rather than external web addresses?
  • To post as a guest, your comment is unpublished.
    Benjamin · 2 years ago
    Amazing. Worked like a charm on excel 2013, no tweaking required, unlike similar fixes I've seen for this problem. THANK YOU sooooo much. Saved a massive headache and hours of time.
  • To post as a guest, your comment is unpublished.
    Jeanie H · 2 years ago
    Thank you so much for developing this! I had a user who created a bunch of hyperlinks on multiple tabs (at least several hundred) and somehow they had a file path to his AppData\Roaming folder on his c drive instead of to the network folder. I was able to use your VBA script to remove that portion of the link code and now it all works. Saved us probably a week's worth of updating and it took me less than 2 minutes to implement!
  • To post as a guest, your comment is unpublished.
    Terri Floren · 3 years ago
    This is brilliant. You saved me SO.MUCH.TIME. today. Thanks for sharing!
  • To post as a guest, your comment is unpublished.
    Terri Floren · 3 years ago
    Wow! This saved me SO.MUCH.TIME. You're awesome. Thanks for sharing!
  • To post as a guest, your comment is unpublished.
    Rob Smith · 3 years ago
    This is the most helpful Excel article I have ever come across. I have had many problems where hyperlinks within a file become corrupted, or I want to move location of some hyperlinked files, and updating has always been a major problem. My Excel programmer didn't have a simple fix. This works faultlessly. I am very grateful - thank you!
  • To post as a guest, your comment is unpublished.
    abdralin · 4 years ago
    it did a lot of help
    thank you very much
  • To post as a guest, your comment is unpublished.
    carl · 4 years ago
    No worries I figured it out and set as a string
  • To post as a guest, your comment is unpublished.
    carl · 4 years ago
    Hey guys what am i missing, I get 'Compile error - Variable not defined' for the XTitleId in Excel 2013 :cry:
  • To post as a guest, your comment is unpublished.
    Peter · 4 years ago
    Brilliant! Thanks a lot!!!!
  • To post as a guest, your comment is unpublished.
    Mansoor · 4 years ago
    Thanks for a brilliant Piece of Program. Works LIKE a CHARM..."WLC"
  • To post as a guest, your comment is unpublished.
    Tony V · 4 years ago
    Is there a way to change multiple hyperlink "text to display" at the same time?
  • To post as a guest, your comment is unpublished.
    Lasse A · 4 years ago
    Thank thanks thanks !!!!!!!
    you saved me for 2 days of work here
  • To post as a guest, your comment is unpublished.
    Dylan · 4 years ago
    mauricio-

    You are awesome! Thanks! Also, for another report I'll need it to just update the links on only specified tabs, is that possible?
  • To post as a guest, your comment is unpublished.
    Dylan · 4 years ago
    How would I change this in order to update hyperlinks that link to references within a workbook rather than external web addresses?
    • To post as a guest, your comment is unpublished.
      mauricio · 4 years ago
      Just needed the same, try these changes:

      Sub ReplaceHyperlinks()
      'Updateby20140220
      Dim Wb As Workbook
      Dim Ws As Worksheet
      Dim xHyperlink As Hyperlink
      Dim xOld As String, xNew As String

      xTitleId = "CambiaLink"
      'Set Ws = Application.ActiveSheet
      Set Wb = Application.ActiveWorkbook
      xOld = Application.InputBox("Old text:", xTitleId, "", Type:=2)
      xNew = Application.InputBox("New text:", xTitleId, "", Type:=2)
      For Each Ws In Wb.Worksheets
      'Application.ScreenUpdating = False
      For Each xHyperlink In Ws.Hyperlinks
      Debug.Print ("voy " & xHyperlink.SubAddress)
      xHyperlink.SubAddress = Replace(xHyperlink.SubAddress, xOld, xNew)
      Next
      Next
      Application.ScreenUpdating = True
      End Sub
  • To post as a guest, your comment is unpublished.
    gav · 5 years ago
    thanks!!!! :lol: that helped a great deal.
  • To post as a guest, your comment is unpublished.
    Kid Jägerskiöld · 5 years ago
    Hi, this seems to work great but some characters (for example "\" and "%"). In my case I have hyperlink adresses like [../../../../../../Application%20Data/Microsoft/2012/Relacom%20Uki-Kantvik-Tallinna-Pietari-Uki_saate151012.xls] and I need to get the start [../../../../../../Application%20Data/Microsoft/] away from the adress from hundreds of links. The beginning of the links are the same, but the ends are different. Do you have any good advice?
  • To post as a guest, your comment is unpublished.
    Eric Ong · 5 years ago
    Hi, could you give me the VB code if i need to change links in Powerpoint instead of excel?

    Thanks
  • To post as a guest, your comment is unpublished.
    alex ximenez · 5 years ago
    love it, you save me a ton of work.
  • To post as a guest, your comment is unpublished.
    Tarun Varshne · 5 years ago
    Ammazing it saved my lots of effort.