Solved

Excel VBA - Add an image to a sheet and name it

Posted on 2014-03-09
2
458 Views
Last Modified: 2014-03-10
Hi

What VBA code would I use to add an image to a specific Excel cell and name it
0
Comment
Question by:murbro
2 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 39916827
This code inserts a picture positioned on cell C3 on Sheet1:

        With ThisWorkbook.Sheets("Sheet1").Pictures.Insert("C:\Users\Kevin Jones\Pictures\IM Avatars\zorvek.jpg")
        .ShapeRange.IncrementLeft ThisWorkbook.Sheets("Sheet1").Range("C3").Left
        .ShapeRange.IncrementTop ThisWorkbook.Sheets("Sheet1").Range("C3").Top
        .Name = "MyPicture"
    End With

Open in new window

Kevin
0
 

Author Closing Comment

by:murbro
ID: 39916856
Thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now