+ Reply to Thread
Results 1 to 9 of 9

Insert Picture based on cell value (using a wild card)

  1. #1
    Registered User
    Join Date
    08-10-2021
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    11

    Insert Picture based on cell value (using a wild card)

    Hello all. Thanks in advance for reading my post.

    This topic can be found all over the place but I'm still stuck when it comes to finding the picture using a wild card.

    I have a spreadsheet with part numbers in column A. I want to find the picture from a folder and then insert it in column be with a size that matches the row and column sizes or just resize the row and column when it gets inserted.

    Where I'm stuck at is the part number in column A may not include the entire picture name. Example: Part number is column A is "ABCDEFG". The picture name is "ABCDEFG_001.png". I've tried using an asterisk for a wild card in various places in the below code but It gives me the "Application-defined or object-defined error" message. If the part number matches the picture name exactly, it does what I'm expecting (except for picture size).

    The code I'm using is below. It is not my code but I have tried to adapt it to my needs and it doesn't go through all the part numbers is column A, only the active cell which will be my next opportunity for improvement. I hope all that makes sense to everyone and again, thanks in advance for your help and guidance.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    1,478

    Re: Insert Picture based on cell value (using a wild card)

    Please Login or Register  to view this content.
    Artik

  3. #3
    Registered User
    Join Date
    08-10-2021
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    11

    Re: Insert Picture based on cell value (using a wild card)

    Thank you for the reply Artik. I updated my code with your suggestions and now I get the "Application-defined or object-defined error" message regardless if the part number matches the picture number or not. I get the message at this line...
    Please Login or Register  to view this content.
    Here is the code with your suggestions in it.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    1,478

    Re: Insert Picture based on cell value (using a wild card)

    Oops, I forgot to add the path. I don't use Dir on a daily basis
    Please Login or Register  to view this content.
    Artik

  5. #5
    Registered User
    Join Date
    08-10-2021
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    11

    Re: Insert Picture based on cell value (using a wild card)

    Artik, works like a charm! Thank you so much. I'm not sure how to make it loop through the whole column A and get the pics for all the cells that have a part number in it. Is that an easy task? I guess "easy" is relative....

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    1,478

    Re: Insert Picture based on cell value (using a wild card)

    It doesn't have to be hard. Only show in the attachment what is the actual data layout and indicate where you expect the name, and where the image.

    Artik

  7. #7
    Registered User
    Join Date
    08-10-2021
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    11

    Re: Insert Picture based on cell value (using a wild card)

    So I tried the below code but it doesn't loop through and it keeps putting the picture on top of the previous picture.... I'm basically going the trial and error process to get this working. I updated folders with the actual names.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    1,478

    Re: Insert Picture based on cell value (using a wild card)

    That's why I asked you to attach an attachment that will show the real data layout, because neither the code nor the description can infer exactly what you expect.
    Since there is no attachment, it will have to be as I see it.

    Assumptions
    1. Column A lists the part numbers.
    2. In column B there will be the name of the found file
    3. In column C there will be an image of the part found
    4. Images are named part number with a prefix "Pic_"
    5. Images will be scaled to the set row height (80 pt)
    6. After the macro is finished, you can click on each image to enlarge it.
    6. The sheet contains two graphic objects which should not be deleted when cleaning the sheet "btnRun" and "Logo".
    Please Login or Register  to view this content.
    Artik
    Last edited by Artik; 08-12-2021 at 09:28 AM.

  9. #9
    Registered User
    Join Date
    08-10-2021
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    11

    Re: Insert Picture based on cell value (using a wild card)

    Thank you again. This is great! I've done some modifying to the code (it's a Hodge Podge right now and I'm sure its inefficient) but I can't get it to start on row 2. My sheet has row headers but nothing I do seems to make a positive impact. Any ideas of how to make it start on row two? Changing the range to "A2" didn't do anything.

    Please Login or Register  to view this content.

+ 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] Google Sheets: Using wild card functions in formula cell references
    By Ian99099 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 02-11-2021, 08:36 AM
  2. [SOLVED] index wild card
    By jpbisani in forum Excel General
    Replies: 6
    Last Post: 06-22-2019, 07:37 AM
  3. Wild Card?
    By mklindquist0815 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2016, 04:22 PM
  4. [SOLVED] Countif/Sumif/Sumproduct under 80 based on wild card value
    By Groovicles in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-04-2014, 04:23 PM
  5. wild card
    By jamrock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2013, 05:47 PM
  6. Wild card in Excel SQL
    By tkuia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2010, 06:36 AM
  7. [SOLVED] Wild card *
    By Herman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-21-2005, 09:05 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