怎么把表格里的文字批量转成链接
发布网友
发布时间:2022-04-29 09:53
我来回答
共2个回答
热心网友
时间:2022-06-25 19:03
用宏吧。Alt+F11打开VB编辑器,粘贴如下代码:
Sub test()
Dim fso, fld, f1, maxRow As Long
maxRow = Sheets("Sheet1").[A65535].End(xlUp).Row
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(ThisWorkbook.Path)
For Each fsfile In fld.Files
Filename = Left(fsfile.Name, Len(fsfile.Name) - 4)
For Each no In Range("a1:a" & maxRow)
If Filename Like no & "*" Then
Cells(no.Row, 1).Hyperlinks.Add Anchor:=Cells(no.Row, 1), Address:=fsfile, TextToDisplay:=Cells(no.Row, 1).Value
End If
Next no
Next
End Sub
关闭后回到Excel界面,Alt+F8运行test宏即可。
热心网友
时间:2022-06-25 19:03
两个方法百度都有,自行百度