跳到主要内容

如何从Excel中的超链接中提取实际地址?

假设您有一个包含超链接的单元格区域,现在您需要查看超链接的真实目的地并从超链接中提取它们,如下面的屏幕截图所示。 有没有简单的方法可以快速解决此问题? 本文将指导您从多个超链接中提取实际地址。


箭头蓝色右气泡 使用“编辑超链接”功能从超链接中提取实际地址

在这里, 编辑超链接 函数可以帮助您提取每个超链接的基础URL并将该实际地址放入另一个单元格中。 您可以这样做:

1。 选择带有超链接的单元格,然后单击鼠标右键,从上下文菜单中选择 编辑超链接,请参见屏幕截图:

2。 和 编辑超链接 对话框将会出现,选择并复制(按Ctrl + C)来自 地址 对话框的字段。

3。 然后关闭对话框,然后将实际地址粘贴到所需的任何单元格中。

备注:使用此方法,每次只能提取一个超链接地址,但是如果需要提取多个超链接,则需要重复应用此功能。


箭头蓝色右气泡 使用VBA代码从超链接中提取实际地址

对于许多超链接,上面的方法将很繁琐且耗时,因此下面的VBA代码可以帮助您一次从超链接中快速提取多个地址。

1。 按住 ALT + F11 键打开 Microsoft Visual Basic应用程序 窗口。

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应用程序 窗口。

2。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

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

3。 保存代码并关闭窗口,选择一个空白单元格以键入此公式 = GetURL(A2) (A2 是超链接所在的单元格),然后按 输入 按钮。 您可以看到实际的超链接地址已提取。


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

这是一个方便的工具,称为 Kutools for Excel,其 转换超链接 功能,您可以快速处理以下操作:

  • 从超链接中提取实际地址;
  • 将网址文字转换为可点击的超链接.
Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用.

如果你已经安装 Kutools for Excel,请执行以下操作:

1。 选择包含需要提取的超链接的范围。

2。 点击 库工具 > 链接 > 转换超链接,请参见屏幕截图:

3。 在 转换超链接 对话框中选择 超链接地址替换单元格内容 选项,然后单击 文档按钮1 来自的按钮 结果范围 指定要放入结果的单元格。

4。 然后点击 OK,实际地址已从超链接中提取。 看截图:

备注:如果您想将实际地址放到原始范围内,请检查 转换来源范围.

点击 转换超链接 进一步了解此功能。

立即下载和免费试用Excel的Kutools!


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

Kutools for Excel:具有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 Tab 为 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