Please login in order to report media.
Insert a picture from the directory on the change of a cell value using Excel VBA.
In this video tutorial when someone changes the value of cell A2, a picture is automatically inserted from a folder in the directory.
The cell is also automatically resized to be the same as the picture.
Learn Excel VBA Fast with our highly rated online course - https://www.udemy.com/excel-vba-course/?couponCode=ExcelVBAYouTube
This macro can be placed in a sub procedure and does not need to run on the worksheet change event.
It could also be used in a loop to insert multiple pictures from that directory.
Below is the code used in the video.
This can be copied and adapted for your own needs.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPict As Picture
Dim PictureLoc As String
If Target.Address = Range("A2").Address Then
PictureLoc = "C:UsersAdminDesktopimages" & Range("A2").Value & ".png"
Set myPict = ActiveSheet.Pictures.Insert(PictureLoc)
.RowHeight = myPict.Height
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize
Find more great free tutorials at;
Connect with us!
Google+ ► https://plus.google.com/+Computergaga
Facebook ► http://www.facebook.com/computergaga
Twitter ► http://www.twitter.com/computergaga1