How to Automate Display of Pictures Using Comments with VBA


We can automate the display of pictures using comments with VBA in Microsoft Excel. The display of pictures automatically can be useful in a variety of situations like if you wish to check an inventory item quickly or wish to identify an employee.

First we learn the process of displaying pictures in a comment box using a standard procedure. Next we use Visual Basic for Applications or VBA to automate the display of images in our Excel worksheet.

Watch the video before you study the VBA code given below:


You may like to watch the video on YouTube
Sub showPic()
For Each cell In Selection
MyPicture = “C:\Users\takyar\Pictures\PillowCases\” & cell.Value & “.jpg”
With cell.AddComment
.Shape.Fill.UserPicture MyPicture
End With
Next cell

End Sub

Download a sample file:


Further reading

One thought on “How to Automate Display of Pictures Using Comments with VBA

Leave a Reply

Your email address will not be published. Required fields are marked *