+ Reply to Thread
Results 1 to 28 of 28

Auto insert picture base on cell value,

  1. #1
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Auto insert picture base on cell value,

    Good day,

    I am new in excel vb programming and i want to seek help from excel master, can any one help to auto insert image base on the result of search data,Attachment 615781
    Attached Files Attached Files
    Last edited by MyVB_polly; 03-16-2019 at 01:15 AM.

  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: Auto insert picture base on cell value,

    Hi,
    You also have to tell where the picture is stored.
    This link will give you some ideas
    https://trumpexcel.com/picture-lookup/
    Hope this helps, we can always help later if you cannot make it work

    Why is your file in an older format? You are using 2010
    ---
    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-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    Thanks Keebellah

    picture are stored in X:\2 Picture\02 Bitmap

    i tried that one but when the search result display, the image didn't show up, but when i manually type the number ex. "10-26000" and hit enter it show up the image.

    may be i can change it to enable macro. yes i am using ms 2010.

  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: Auto insert picture base on cell value,

    Well, try the link I posted,
    I don't have the same path so you will have to edit it yourself.
    I suggest you save the file as an xlsm (marco embedded file) after you modified the xls file.

  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: Auto insert picture base on cell value,

    If you look at the contents of the cell in Column A and if you check that cell you will see that the value is '10-26005 with the apostrophe and that is the reason it won't work when the macro runs but only when you enter the value manually.
    I'll see if I can try something, the shape should fill the destination cell, correct?

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

    Re: Auto insert picture base on cell value,

    Question, the shape's name: is that the partnumber, what is the text in column G?

  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: Auto insert picture base on cell value,

    Okay, I got it working, will upload after dinner

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

    Re: Auto insert picture base on cell value,

    As promised:
    My (working code)
    Please Login or Register  to view this content.
    The file's attached in xlsm format
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Talking Re: Auto insert picture base on cell value,

    Again thank you very much

    did you put some missing code?
    because i encounter error when i try it.
    this is the pup up error .Untitled.png

    i couldn't fix it.

  10. #10
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    this is the sample image
    Attached Images Attached Images

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

    Re: Auto insert picture base on cell value,

    Nope as far I can see you are the one missing out.
    Read the the lines BELOW LastRow

  12. #12
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    I am sorry but i don't know how to fix it. could you please tell me what to do?

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

    Re: Auto insert picture base on cell value,

    Does the folder that is mentioned in the const filepath exist?

  14. #14
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    Yes the folder existing. i also tried to move the folder to my desktop. but still it wont work.

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

    Re: Auto insert picture base on cell value,

    Can you attach YOUR file again?
    This is just something you have to check, it worked here so maybe the name in the cell is invalid or it's empty or something else.

  16. #16
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    here are the files.
    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: Auto insert picture base on cell value,

    Thanks will look at it

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

    Re: Auto insert picture base on cell value,

    The reason you got the error is because you did not include a check to see if the selected target cell contained any text.
    Apart from that you hard-code a full path in your code so that when you decide to change the picture folder to another location you always have to edit the vba code like I did to able to test it.
    I made some (mayor) modifications to your file and added some code to make it work.

    The first one is check if the picture folder is present (known to the file), if not a browser will open that will permit you to select the folder containing the images, if the selected folder contains no images the process will not run.

    I added two extra buttons, on with text and one is an image of FOLDER

    The SEARCH button is unchanged except for the fact that I assure it affects the correct worksheets. in your case you omitted this so it you start the macro while you're still in the DATA sheet it erases the content of the data sheet.
    Once the SEARCH is pressed all images are cleared as well as the text NO IMAGE FOUND, not a file just text in that cell.
    After the SEARCH is completed then you press the button REFRESH SHAPES, this macro processes the present list and places the images in their place or the text NO IMAGE FOUND in the corresponding cell

    Pressing the FOLDER button allows you to select another folder for the images location.

    (see attached thumbnail)
    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: Auto insert picture base on cell value,

    Reduced the vba code to a single module for image placement and also removed the unnecessary black borders which you had over the entire worksheets height (over 1 million rows )
    You can make it 'dynamic'using Conditional format rules.
    Let me know if it all works on your side too, the day's almost over on your side of the globe
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    Sorry, i will try it.

    Thank you very much.

  21. #21
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    Good day,

    Sorry for the late reply, this are the error i enconter when i pon your work. what should i do?
    Attached Images Attached Images

  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: Auto insert picture base on cell value,

    Sorry my mistake, should have added an extra check to verify if a correct image folder had been selected. Added a correction and this should work, if not... let me know.
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    HI

    Wow you are so good in this kind of work.
    it works now!

    thank you very much keebellah.

  24. #24
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    one more thing how can i auto resize the cell according to the size of bitmap
    ?

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

    Re: Auto insert picture base on cell value,

    Why would you want to do that? It will make the list very messy.
    If it's just to see the bitmap with more detail there is a way to show the full bitmap in a userform that cab be zoomed in or out.

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

    Re: Auto insert picture base on cell value,

    Right-Click Column B and see if this helps you

    The image can be resized by dragging at the corners
    Attached Images Attached Images
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    03-01-2019
    Location
    cavite
    MS-Off Ver
    2010
    Posts
    14

    Re: Auto insert picture base on cell value,

    Wow this is so awesome. thank you very much keebella.
    your so great.

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

    Re: Auto insert picture base on cell value,

    You're welcome

+ 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 on cell value base and auto fit in selected cell.
    By M. Shahbaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2019, 02:51 AM
  2. Show picture automatically base on value in cell
    By phan sang in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-25-2017, 02:49 AM
  3. auto insert picture
    By mate29 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-02-2017, 08:40 AM
  4. [SOLVED] Insert Picture in cell, click commanbutton to rename picture, lock cell and remove button
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2014, 10:05 PM
  5. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  6. Insert picture and auto rotate and resize to cell range dimensions
    By jwagman1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2012, 03:49 PM
  7. Displaying a picture base on cell content
    By Speclt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2010, 10:22 AM

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