ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to insert picture using VBA which refer to cell value (https://www.excelbanter.com/excel-programming/432104-how-insert-picture-using-vba-refer-cell-value.html)

geniusideas

How to insert picture using VBA which refer to cell value
 
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..

joel

How to insert picture using VBA which refer to cell value
 
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

"geniusideas" wrote:

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..



All times are GMT +1. The time now is 05:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com