I tried to add multiple pictures to multiple cells using the following add comment macro. It works perfectly when there are images in pictures1 folder that correspond to the values in the selected cells.There are instances where some images are not in the folder and the macro will return an error. What lines of code do I need to add to force it to skip those cells and continue to add comment to the next cell. Thank you.
Sub Addpic()
For Each cell In Selection
MyPic = "C:\Pictures1\" & cell.Value
With cell.AddComment
.Shape.Fill.UserPicture MyPic
.Shape.Height = 300
.Shape.Width = 300
End With
Next cell
End Sub
Sub Addpic()
For Each cell In Selection
MyPic = "C:\Pictures1\" & cell.Value
With cell.AddComment
.Shape.Fill.UserPicture MyPic
.Shape.Height = 300
.Shape.Width = 300
End With
Next cell
End Sub