批量替换Excel超级链接

来源:互联网 发布:淘宝入驻条件及流程 编辑:程序博客网 时间:2024/05/21 10:01

使用宏来实现是最简单有效的。
执行时根据提示先输入被替换的链接,再输入替换成的链接,轻松替换~

Sub ReplaceLink()
'
' ReplaceLink Macro'

'
Dim sTobeReplaced As String
Dim sReplaceWith As String


sTobeReplaced = InputBox('What link content to be replaced?', 'What link content to be replaced')
sReplaceWith = InputBox('What link content to be replaced with?', 'What link content to be replaced with?')


For Each Ws In Application.Worksheets

For Each h In Ws.Hyperlinks
    If InStr(h.Address, sTobeReplaced) <> 0 Then
    aLink = Replace(h.Address, sTobeReplaced, sReplaceWith)
    h.Address = aLink
    End If
Next

Next

参考:http://hi.baidu.com/mysekai/blog/item/3c0ceb03863907e009fa93fb.html

原创粉丝点击