跳到主要內容

如何從Excel中的超鏈接中提取實際地址?

假設您有一個包含超鏈接的單元格區域,現在您需要查看超鏈接的實際目的地,並從超鏈接中提取它們,如下面的屏幕截圖所示。 有沒有簡單的方法可以快速解決此問題? 本文將指導您從多個超鏈接中提取實際地址。


箭頭藍色右氣泡 使用“編輯超鏈接”功能從超鏈接中提取實際地址

在這裡, 編輯超鏈接 函數可以幫助您提取每個超鏈接的基礎URL並將該實際地址放入另一個單元格中。 您可以這樣做:

1。 選擇帶有超鏈接的單元格,然後單擊鼠標右鍵,從上下文菜單中選擇 編輯超鏈接,請參見屏幕截圖:

2。 和 編輯超鏈接 對話框將會出現,選擇並複制(按Ctrl + C)來自 地址 對話框的字段。

3。 然後關閉對話框,然後將實際地址粘貼到所需的任何單元格中。

備註:使用此方法,每次只能提取一個超鏈接地址,但是如果需要提取多個超鏈接,則需要重複應用此功能。


箭頭藍色右氣泡 使用VBA代碼從超鏈接中提取實際地址

對於許多超鏈接,上面的方法將很繁瑣且耗時,因此下面的VBA代碼可以幫助您一次從超鏈接中快速提取多個地址。

1。 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下代碼粘貼到“模塊窗口”中。

Sub Extracthyperlinks()
'Updateby Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    If Rng.Hyperlinks.Count > 0 Then
        Rng.Value = Rng.Hyperlinks.Item(1).Address
    End If
Next
End Sub

3。 然後按 F5 鍵運行代碼,並彈出一個對話框供您選擇要提取真實地址的超鏈接,請參見屏幕截圖:

4。 然後點擊 OK,並且所選單元格內容已轉換為原始範圍內的實際超鏈接地址。 查看屏幕截圖:


箭頭藍色右氣泡 使用用戶定義功能從超鏈接中提取實際地址

以下用戶定義函數也可以從超鏈接中提取實際的URXNUMX。

1。 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下代碼粘貼到 模塊窗口.

Function GetURL(pWorkRng As Range) As String
'Updateby Extendoffice
    GetURL = pWorkRng.Hyperlinks(1).Address
End Function

3。 保存代碼並關閉窗口,選擇一個空白單元格以鍵入此公式 = GetURL(A2) (A2 是超鏈接所在的單元格),然後按 Enter 按鈕。 您可以看到實際的超鏈接地址已提取。


箭頭藍色右氣泡 使用Kutools for Excel快速輕鬆地從超鏈接中提取實際地址

這是一個方便的工具,稱為 Excel的Kutools,其 轉換超鏈接 功能,您可以快速處理以下操作:

  • 從超鏈接中提取實際地址;
  • 將網址文字轉換為可點擊的超鏈接.
Excel的Kutools : 帶有300多個便捷的Excel加載項,可以在30天內免費試用.

如果你已經安裝 Excel的Kutools,請執行以下操作:

1。 選擇包含需要提取的超鏈接的範圍。

2。 點擊 庫工具 > Link > 轉換超鏈接,請參見屏幕截圖:

3。 在 轉換超鏈接 對話框中選擇 超鏈接地址替換單元格內容 選項,然後單擊 文檔按鈕1 來自的按鈕 結果範圍 指定要放入結果的單元格。

4。 然後點擊 OK,實際地址已從超鏈接中提取。 看截圖:

備註:如果您想將實際地址放到原始範圍內,請檢查 轉換來源範圍.

點擊 轉換超鏈接 進一步了解此功能。

立即下載和免費試用Excel的Kutools!


箭頭藍色右氣泡 演示:使用Kutools for Excel從超鏈接中提取實際地址

Excel的Kutools:具有300多個方便的Excel加載項,可以在30天內免費試用,沒有任何限制。 立即下載並免費試用!

相關文章:

如何在Excel中將URL文本轉換為可單擊的超鏈接?

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (44)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour
Auriez vous une solution pour mettre en place le fonctionnement par la formule sur Excel 365 sur Mac ?
This comment was minimized by the moderator on the site
Hello, Edouard,
Sorry, the methods in this article are only applied to Microsoft Excel.
Thank you!
This comment was minimized by the moderator on the site
Ola colegas ,

Tenho uma planilha com mais de 2000 linhas, preciso exportar o documento que esta no hiperlink estas celulas, para um diretório da maquina, alguém sabe como fazer ?

agradeço a atenção

at..
cássia
This comment was minimized by the moderator on the site
Thank you it solve my problem
This comment was minimized by the moderator on the site
Thank you, the VBA code worked like a charm :)
This comment was minimized by the moderator on the site
Thank you for the tip to Extract Actual Addresses From Hyperlinks in Excel With VBA Code. It was exactly what I needed!
This comment was minimized by the moderator on the site
How does this apply to Excel on Mac?
This comment was minimized by the moderator on the site
I think it's nice to have an option that doesn't require macros since so many haven't used VBA at all.
This comment was minimized by the moderator on the site
If you're not comfortable with VBA, the key step to getting this done is the FORMULATEXT() formula that is included with excel. For example, if cell A1 has this...
=HYPERLINK("https://www.google.com","Google Homepage")
...then it would display "Google Homepage" but you want to extract "https://www.google.com". You can use =FORMULATEXT(A1) to get the output of "=HYPERLINK("https://google.com","Google Homepage")".

Then you use the find and mid functions to find the double quotes (which is CHAR(34)) and pull the string between the first two double quotes. Nesting it all together, you can use this formula to get the URL without any VBA required...
=MID(FORMULATEXT(A1),FIND(CHAR(34),FORMULATEXT(A1))+1,FIND(CHAR(34),FORMULATEXT(A1),FIND(CHAR(34),FORMULATEXT(A1))+1)-FIND(CHAR(34),FORMULATEXT(A1))-1)
This comment was minimized by the moderator on the site
Thankyou for an easy method to extract the complete URL from a weblink. I looked at other methods that were too nebulous but yours was straightforward and easy. Thanks.
This comment was minimized by the moderator on the site
Thanks for the " Extract actual addresses from hyperlinks with VBA code" VBA and clear instructions. It worked great for me.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations