+ Reply to Thread
Results 1 to 14 of 14

How to automatically insert image?

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    How to automatically insert image?

    HI
    I create a drop down list and I have a quick question. I want to when I choose a product from dropdown list, the image of that product automatically put in other cell. is that possible ?

  2. #2
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: How to automatically insert image?

    Good time of day, aidda!

    How about something like in the attachment? Step by step what I did:

    1). I inserted random image in A1 ("main" sheet)
    2). In cell A10 I've made a drop list from future names.
    3). On sheet "Gear" I deployed a table with images and names.
    4). I've made a formula for "logo" named range (browse my file).
    5). I've selected image from (1) step and in formula window printed "=logo"
    Attached Files Attached Files
    Best wishes and have a nice day!

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to automatically insert image?

    There are several approaches to doing what you want.
    • Do you want just one product image to be displayed at a time? Or will you be selecting several/many products and you want to see an image for each?
    • Are you able to use VBA in the final solution?
    • How many product images must be available for displaly?
    • Will the images be stored within the workbook or on a network server?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    Thank you Rioran
    would you please explain me where is a logo formula ?
    and do you think, is that possible to call the image from other folder?

  5. #5
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    There are several product and several images and the images on server ( in this case my computer )
    For sure VB is the best solution but at this time I don't know how to use VB.
    For instance when I use product 1 in cell 1 , the image should be going to cell 2. So, just one image should appear in the worksheet

  6. #6
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    and if the vb is the best way, would you please help me with VB solution ?

  7. #7
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: How to automatically insert image?

    Aidda, I don't know how it is exactly called in English, but I'll try to explain =)

    In Excel 2010 you need to open "Formulas" menu, then go to "Names manager" button (looks like three stickers above a flat box). Here you will find "logo" named range. Double click or "Change" menu will open "logo"-formula for you.

    If it is not adequate to import all of your images into excel file, then yes - VBA will be more productive. By the way, you have two obvious options:

    1). To import all images by VBA code.
    2). Or to call images, but mechanism of this operation will differ from what I showed.
    Last edited by Rioran; 12-22-2014 at 11:00 AM. Reason: Grammar

  8. #8
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    Quote Originally Posted by Rioran View Post
    Aidda, I don't know how it is exactly called in English, but I'll try to explain =)

    In Excel 2010 you need to open "Formulas" menu, then go to "Names manager" button (looks like three stickers above a flat box). Here you will find "logo" named range. Double click or "Change" menu will open "logo"-formula for you.

    If it is not adequate to import all of your images into excel file, then yes - VBA will be more productive. By the way, you have two obvious options:

    1). To import all images by VBA code.
    2). Or to call images, but mechanism of this operation will differ from what I showed.
    Oh! I found it. I think the formula should be in cell.
    Thank you

  9. #9
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to automatically insert image?

    To select an image file name from a dropdown list and have Excel display the image in a range of cells:
    (I can't post workbooks from my job, so I've provided instructions as an example)

    • Enter the path to your picture folder in a cell...Z1
    ...Example: C:\PicFolder\
    • Name that cell: PictureFolder

    • Select a cell that cell will hold the file name (without the path or file extension)
    ...It can be populated by a dropdown list...A1
    ...The dropdown list should contain actual file names (without the file extensions..Example: KnifflePinExtender)
    • Name that cell: rngDisplayName

    • Select a cell that will contain a formula that concatenates: the folder, file, and extension...Z2
    • Enter this formula in that cell: =PictureFolder&rngDisplayName&".jpg"
    ...Use the same file extension that your files have.
    • Name that cell: rngFileLocation

    • Select a rectangular range of cells that will be used to display the image.......A2
    • Name that range of cells: rngPicDisplayCells
    • Set the row height and column width large enough to display the image

    • Press ALT+F11 to open the VBA Editor
    • Select your workbook name in the VBA Project window
    ...Insert.Module

    • Copy the below VBA code and paste it into that window:
    Please Login or Register  to view this content.

    • Right-click the tab name in your workbook and select: View Code
    • Copy the below VBA code and paste it into that window:
    Please Login or Register  to view this content.
    When you change the value of the rngDisplayName cell
    ...The Worksheet_Change macro detects the activity and runs the InsertPicFromFile macro, which sizes the referenced picture so it fits in the rngPicDisplayCells

    Example:
    If you select KnifflePinExtender
    then this image will be placed in A2
    C:\PicFolder\KnifflePinExtender.jpg

    Is that something you can work with?

  10. #10
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    Thank you very much for you help.
    But I just confused with the second part.
    first I want to chose product from drop down list and then appear its picture in B6. Because I can't understand the second part I could not follow the steps ...
    Attached Files Attached Files
    Last edited by aidda; 12-22-2014 at 04:08 PM. Reason: not complete

  11. #11
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    Finally I can solve my problem with Ron Coderre's solution. Thank you so much for your help and coherent explanation.

  12. #12
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to automatically insert image?

    Glad you got something you can use!
    I apologize for the delay. Sometimes my "real job" interferes with my forum activity.

  13. #13
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to automatically insert image?

    I just have another question
    How should I save it that work it again. because when I save it ordinary way it does not work again and I should put the code again.

  14. #14
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to automatically insert image?

    You need to change the file type from .xlsx to .xlsm or to .xlsb so macros can be saved.
    Did you do that?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] how to insert image in the ImageList with the image inside the tab?
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2014, 09:21 AM
  2. Insert image and image name into specific place on sheet
    By ACE23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2014, 04:41 AM
  3. [SOLVED] Insert jpg image from file path to image frame
    By SAsplin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-27-2012, 10:12 AM
  4. Replies: 1
    Last Post: 08-03-2006, 08:00 AM
  5. [SOLVED] automatically insert each image to its own sheet
    By jwewing23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-16-2005, 05:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1