Show image from folder based on cell value in MS Excel
2 answers
With this code, you can insert an image into a cell F20
using the path that is stored in the cell A1
. Use the full path like D:\one.jpg
. Change Tabelle1
to your sheet name.
Sub Test()
Dim objPicture As Picture
With Tabelle1.Cells(20, 6) ' Picture starts in cell F20 -> change as you need
Set objPicture = .Parent.Pictures.Insert(Tabelle1.Cells(1, 1).Value)
objPicture.Top = .Top
objPicture.Left = .Left
objPicture.Height = 150
objPicture.Width = 150
End With
End Sub
+2
source to share
I am still facing the problem. I have a folder named X and in it I have several folders named a, b, c and in that folder there are images. Now I want that after traversing one image path in A1, the image of that path appears in B1.
I tried to do the same using the VBA code above but ran into obj not found error.
Please, help
0
source to share