提示:其他語言是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。 支持所有語言。 在您的企業或組織中輕鬆部署。 全功能30天免費試用。
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 · 5 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 · 5 months ago
      I´m the same problem. What´s the reason?
  • To post as a guest, your comment is unpublished.
    Fabio · 2 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 · 4 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 · 5 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 · 5 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 · 5 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.