MBA智库

vba,excel,网址提取名字与链接url

 
 

 

'宏操作

Sub 复制超级链接()

For a = 1 To 100 '这里控制读取A列的第1到10行,你根据自已的要求修改一下起始和结束行数
    If Cells(a, 1).Hyperlinks.Count > 0 Then Cells(a, 2).Value = Cells(a, 1).Hyperlinks.Item(1).Name

    If Cells(a, 1).Hyperlinks.Count > 0 Then Cells(a, 3).Value = Cells(a, 1).Hyperlinks.Item(1).Address
    
Next

End Sub
'自定义公式法
Function geturl(c As Range) As String
    geturl = c.Hyperlinks(1).Address
End Function

Function getname(c As Range) As String
getname = c.Hyperlinks(1).Name
End Function

 

posted @ 2018-06-01 16:31  冷色008  阅读(1286)  评论(0编辑  收藏  举报