I'm using the macro below to insert the picture corresponding to the value in Cell P2 into cell Q2.
This works for the one cell selected (P2 in this case).
I want to create a loop to do the same action for the rows in Column P range (P2:P500) that are not blank.
Sub Picture()
Range("Q2").Select
Dim picname As String
picname = "C:\Users\kisnahr\Pictures\Test\" & Range("P2") & ".bmp" 'Link to the picture
ActiveSheet.Pictures.Insert(picname).Select
With Selection
.Left = Range("Q2").Left
.Top = Range("Q2").Top
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 80#
.ShapeRange.Width = 80#
.ShapeRange.Rotation = 0#
End With
Range("Q10").Select
Application.ScreenUpdating = True
Exit Sub
ErrNoPhoto:
MsgBox "Unable to Find Photo" 'Shows message box if picture not found
Exit Sub
Range("P20").Select
End Sub