Public Sub Set_Comment()
Dim Rng As Range, sCell As Range, iRow%
Dim fso As Object, filePath As String
Set fso = CreateObject("Scripting.FileSystemObject")
With Sheet2
iRow = .Range("A10000").End(xlUp).Row
Set Rng = .Range("A10:A" & iRow)
For Each sCell In Rng
filePath = ThisWorkbook.Path & "\PIC\" & sCell.Value & ".jpg"
If fso.FileExists(filePath) Then
With sCell
If sCell.Comment Is Nothing Then .AddComment
.Comment.Shape.Width = 100
.Comment.Shape.Height = 130
.Comment.Shape.Fill.UserPicture filePath
End With
Else
If Not sCell.Comment Is Nothing Then sCell.Comment.Delete
End If
Next sCell
End With
Set fso = Nothing
End Sub