Sub hy()
Dim Sheet1 As Worksheet
Dim a As Integer
Dim i As Integer
Dim n As String
a = [b65536].End(xlUp).Row
Set Sheet1 = ThisWorkbook.Worksheets(1)
For i = 1 To a
n = "目录\" & Cells(i, 2).Value & ".jpg"
If FileFolderExists(n) Then
Sheet1.Hyperlinks.Add Anchor:=Cells(i, 3), Address:=n, _
TextToDisplay:=Cells(i, 2).Value
End If
Cells(i, 3).Font.Name = "ISOCPEUR"
Next
End Sub
Public Function FileFolderExists(strFullPath As String) As Boolean
On Error GoTo EarlyExit
If Not Dir(strFullPath, vbDirectory) = vbNullString Then FileFolderExists = True
EarlyExit:
On Error GoTo 0
End Function
这个是链接图片的代码,没有的就不会出现,其中目录要自己改
在备份后操作
温馨提示:答案为网友推荐,仅供参考