How to insert picture using VBA which refer to cell value

G

geniusideas

Hi guys! need urgent help

I have new project to create simple macro that can insert photo from
specific folder in c:/ drive which is refer to cells value for example
Cells A1 = apple, then I have to insert apple.jpg picture into
specific location in same sheet then if
Cells A2 = orange, then I have to insert orange.jpg picture below
apple.jpg picture and etc...

Pls help.Thanks..
 
J

Joel

This request is proeety simple. Not sure why you didn't get a response
sooner. The onluy issue I see is you didn't specify where the picture should
be placed or the size of the picture. You could end up with multiple
pictures placed on top of each other.

Sub Insert()

Folder = "c:\temp\"

RowCount = 1
Do While Range("A" & RowCount) <> ""
PictName = Range("A" & RowCount)
Set newpict = ActiveSheet.Pictures.Insert( _
Folder & PictName & ".jpg")

RowCount = RowCount + 1
Loop


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top