+ Reply to Thread
Results 1 to 22 of 22

Pictures in Drop Down Selection

  1. #1
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Pictures in Drop Down Selection

    Would it be possible to insert pictures as a "comment" when a specific item is selected from a drop down?

    I am working on an existing equipment parts spreadsheet and want to add pictures for each part number. The drop down selects the description and the item number is generated in a non-editable cell two columns to the right. See below screenshot. Ideally the picture would only appear when the mouse hovered over, similar to a comment. The picture display location isn't important as long as it could be displayed. The non-editable cells must remain, so no one changes the part codes by accident.

    In a related thread additional text comments were able to be created in this manner. The thread was called "comments for drop down list items?", unfortunately I can't post a link at this time.

    Screenshot Example.JPG

    Thank you for the assistance!

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    Hi maybe this link will help.
    I would do it in a cell, but a comment is possible
    https://www.thespreadsheetguru.com/t...o-cell-comment
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Thanks Keebellah for the resource!

    The challenge with this is the drop down will need the cell picture to change as well. I am able to insert a picture for one part number but the drop down contains multiple different items acting on the same active cell. Unless I'm not understanding the VBA correctly.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    I didn't look into the code but this would be the idea, the image changes depending on what you 'trow' at it.
    So all you need to do is clear the image already present and replace it with the new one, but if it's only the picture you want to see you could also use a userform

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    May I assume that the images are all the same type (jpg or gif or something like that) and all in a separate folder?

  6. #6
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Correct. They can be jpg and stored in a separate folder.

    I don't have much experience with userforms but if that seems to be the easiest method I'm open to that. Seeing the possibility of having a comment box update based on the selected drop down showed me this might be possible to do with pictures.

    Thanks for the attention and response on this.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    Could you attach a dummy sample file with 2 or three image files and the folder name they're in? Will make it easier to help

  8. #8
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Sure, see attached spreadsheet. This is a small sample of the existing sheet but it has the same functionality.

    I couldn't attach pictures in excel due to size limits. The photos I tried to attach were much too large of a size. Any photo will work, sorry I couldn't include this.
    Attached Files Attached Files

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    No problem I'll take a look and see how I can help you.
    I'll download the file an update when I have something for you

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    This is what I came up with the following

    You must chance this first:
    The red underlined text: place the fullpath to your image folder here
    Please Login or Register  to view this content.
    I've attached on image file named 'NoImage.jpg" make sure it's in your image folder

    Just select the equipment form your dropwdown in column A.
    The code only checks A6 and A7
    Hope it works on your side
    Attached Images Attached Images
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    That is exactly the functionality needed. Thank you.

    There was an error though. I updated to the file location but the picture isn't being found. I verified the file type is a ".jpg". See attached. The two pictures in the file are named "Equipment B" & "Equipment C".

    Do I need to name the pictures anything specific?
    Attached Images Attached Images

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    I assumed that it would be the part code,
    Like this.
    The number, the image is random
    Attached Images Attached Images
    Last edited by Keebellah; 03-26-2020 at 06:44 PM. Reason: attachments added

  13. #13
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Fixed. I should have assumed that. I have two last questions in scaling this up.

    1) How can I scale this so it applies to many cell rows with a gap between cell rows? The final spreadsheet will have 4-8 consecutive rows followed by a spacer cell, and this will repeat. See picture for final format.

    2) I increased the scale value but the image did not become larger, is there another part of the code to modify for a larger image?
    Attached Images Attached Images

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    Try this
    The image is shown in a user from.

    The condition is that the range to check is column A (or whatever you change it to but that contains the equipment description, and the column next to it contains the Equipment code
    This works much better that a Comment

    modules are a userform and a unused GeneralPurposemodule that now holds the path.
    The idea is to make that interactive but this for testing and see if it's better since scaling works better
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    I encountered an image path error, see attached. This was the same file location that worked with the previous method so it seems to be the correct location.

    The final format will have a column ("Qty") between the description and part code. Would I just change the "target offset" from 1 to 2 to correct for this? I attached the formatted sample.
    Attached Images Attached Images
    Attached Files Attached Files

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    You forgot the final backslash that I mentioned in one of the previous answers.
    I modified and corrected you file

    I suggest you don't use the desktop as location, this unnecessarily creates oversize user profile
    Attached Files Attached Files

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    There was a small error in my code.
    Updloaded corrected file
    Attached Files Attached Files
    Last edited by Keebellah; 03-29-2020 at 11:54 AM.

  18. #18
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Thank you, this works well. Do you have any advice on copying the code to a new workbook?

    To put this in action I will need to apply this code to the final spreadsheet. When I tried to create a new sheet I received the attached error. I renamed the modules and verified the new name was changed in the code when called for.
    Attached Images Attached Images
    Attached Files Attached Files

  19. #19
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    Well, where's the userform? You have something named ShowImageForm but where is the original form?

  20. #20
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    You know you can just drag vba modules between files, only cls modules (worksheet modules) have to be copied
    Range P1 holds the picture path, no need to change it it goes automatically
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    03-25-2020
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    10

    Re: Pictures in Drop Down Selection

    Thank you for the effort and time on this project. I will need to apply this to the main spreadsheet but I consider this solved.

  22. #22
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Pictures in Drop Down Selection

    Just make sure the userform is correct, your userform was empty. that's why the error occurred.
    The PICTPATH (named range) I introduced so that it's easier to select the picture folder

+ 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. Having issue with Selection.CopyPicture when exporting Pictures to PowerPoint
    By Bobbbo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2018, 07:01 PM
  2. Replies: 2
    Last Post: 12-10-2014, 12:42 AM
  3. [SOLVED] Loading pictures into userform as per selection vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-05-2014, 07:39 PM
  4. Drop down with pictures
    By JNoonan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-24-2014, 03:23 PM
  5. Replies: 3
    Last Post: 07-31-2013, 11:53 AM
  6. Autolock Cells from a Drop Down List Selection and a Calendar Selection
    By John Anderson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2013, 10:54 AM
  7. [SOLVED] disable selection of pictures
    By Abe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2006, 11:05 AM

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