码迷,mamicode.com
首页 > 其他好文 > 详细

提取EXCEL文字中的链接

时间:2020-03-09 20:57:26      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:insert   ext   add   提取   set   文字   cti   orm   hyper   

Sub 提取链接()

For Each cell In Selection.Cells
cell.Offset(0, 1) = cell.Hyperlinks(1).Address
Next

End Sub



Sub 提取文字中链接的id()

Selection.Cells.Offset(0, 1).EntireColumn.Insert
For Each cell In Selection.Cells
cell.Offset(0, 1) = cell.Hyperlinks(1).Address
cell.Offset(0, 1) = Mid(cell.Offset(0, 1), InStr(cell.Offset(0, 1), "id=") + 3, 12)
With cell.Offset(0, 1)
.NumberFormatLocal = "0_ "
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
cell.Offset(0, 1).Value = "‘" & cell.Offset(0, 1).Value
Next

End Sub



Sub id转链接()
Selection.Cells.Offset(0, 1).EntireColumn.Insert
Selection.Cells.Offset(0, 1).EntireColumn.Insert
For Each cell In Selection.Cells
cell.Offset(0, 1) = "https://detail.tmall.com/item.htm?id=" & cell
cell.Offset(0, 2) = "//h5.m.taobao.com/awp/core/detail.htm?id=" & cell
Next

End Sub



Sub 提取id并转链接()
Selection.Cells.Offset(0, 1).EntireColumn.Insert

For Each cell In Selection.Cells
cell.Offset(0, 1) = Mid(cell, InStr(cell, "id=") + 3, 12)
With cell.Offset(0, 1)
.NumberFormatLocal = "0_ "
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
cell.Offset(0, 1).Value = "‘" & cell.Offset(0, 1).Value
cell.Offset(0, 2) = "https://detail.tmall.com/item.htm?id=" & cell.Offset(0, 1)
cell.Offset(0, 3) = "//h5.m.taobao.com/awp/core/detail.htm?id=" & cell.Offset(0, 2)
Next

End Sub

提取EXCEL文字中的链接

标签:insert   ext   add   提取   set   文字   cti   orm   hyper   

原文地址:https://blog.51cto.com/13984984/2476796

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!