+ Reply to Thread
Results 1 to 13 of 13

Stacking Pictures When Cell Conditions Met

  1. #1
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Stacking Pictures When Cell Conditions Met

    Hello All,

    I have a series of pictures that I would like a macro to populate pictures dependent on a cell value. I would like these pictures to stack on top of each other to create a composite picture.

    Attached is a sample of my workbook, I am not sure this is feasible but I figured I would ask!

    I have tried using an indirect function but am having issues with the overlay and sizing.

    Thank you for your time and any feedback, let the know if you need any more info!

    Kyle
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    You can use a worksheet_change event to make the pictures visible.
    This example I have the target address as C1, when you select from c1, the pictures will become visible or hidden.
    Please Login or Register  to view this content.
    NOTE:

    I forgot to mention, I named the pictures as well.
    Attached Files Attached Files
    Last edited by davesexcel; 12-05-2018 at 04:01 PM.

  3. #3
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    Thank you very much davesexcel, This is very helpful.

    I have successfully recreated the outcome on my worksheet, I do have two follow up questions:

    1. Can I have the target address on another sheet? I have tried to add in the name of the sheet before the cell but have been unsuccessful so far.
    2. For the target cell: The text coming up in this cell is created by a formula, and I cannot seem to get the change event to happen if the cell is referenced, only if I directly type in the condition.

    I would like the pictures to show up based on the results in Sheet1 cell H6. The cell is dependent on an x being placed in either E6 or F6 or both to get None Left Right Or Both
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    Ah..
    The worksheet_change event has to be in the actual sheet's module you are changing.
    Right click the sheet1 tab and select "View Code", place this code there.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    I apologize, I am not very educated on VBA. I also want to make sure I am understanding your response,

    The worksheet_change event has to be in the actual sheet's module you are changing.

    I cannot have the pictures show up on sheet2 if the reference cell is on sheet1?

    Right click the sheet1 tab and select "View Code", place this code there.

    I have placed this code in the sheet one code area but am not seeing any changes to the workbook when an X is placed in E6, F5 or both.

    Thank you for your patience and help with this.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    Here is your wb,
    BTW it's E6 & F6
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    Thank you so much, I am not sure what I was doing wrong before but this works exactly as I dreamed!!!

    I figured out that my beforedoubleclick will not trigger the change event, is there an easy solution to set a beforedoubleclick event in the "target, range" to trigger the change event? Or maybe I am asking too much of this spreadsheet. Below is my code for both the beforedoubleclick and for the change event.

    BeforeDoubleClick

    Please Login or Register  to view this content.

    Event change

    Please Login or Register  to view this content.
    Again thank you so much that was a problem I was working on for quite sometime and no other solutions worked, the change event was the perfect solution.

    Kyle

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    You have set enableevents to false so the worksheet_change event won't kick in

  9. #9
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    I see.

    Thank you so much for all your help. You have been very patient and helpful!!!

  10. #10
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    Here is a cleaner version,
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    Great, I appreciate this!

    Im having some trouble getting a picture to show up if the reference cell has a formula in it. Is this possible? Below is the code, I have tried adding in application.enableevents, but have not had success.

    Please Login or Register  to view this content.
    the formula in the cell is
    Please Login or Register  to view this content.
    I am hoping to have the picture pop up any time that D2 is greater than 2.

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Stacking Pictures When Cell Conditions Met

    If D2 is being changed by using a formula, then you would have to use the worksheet_calculate event.

    worksheet_change event only kicks in when you physically change a range.

    Check out worksheet events here

    https://www.excelforum.com/tips-and-...et-events.html

  13. #13
    Registered User
    Join Date
    09-17-2018
    Location
    Beijing, China
    MS-Off Ver
    Office 360, 2016
    Posts
    77

    Re: Stacking Pictures When Cell Conditions Met

    Oh wow this is perfect! I will use this and these formulas a lot! It helped my figure out the calculate event. Amazing!
    Thank you!

+ 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. Replies: 3
    Last Post: 01-19-2018, 09:17 AM
  2. adding or stacking multiple links to one cell
    By hopefulhart in forum Excel General
    Replies: 3
    Last Post: 10-25-2013, 11:46 PM
  3. [SOLVED] vertically stacking the values in multiple rows into cell.
    By aditi7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-20-2013, 06:03 AM
  4. Inserting multiple pictures cell by cell and pictures are resized to fit the cell
    By kfc429 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2012, 05:47 AM
  5. Showing pictures when certain conditions are met
    By foxster8 in forum Excel General
    Replies: 3
    Last Post: 06-12-2012, 07:40 AM
  6. [SOLVED] Excel's Compress Pictures or deleting pictures doesn't seem work
    By guidod in forum Excel General
    Replies: 1
    Last Post: 01-29-2006, 02:50 AM
  7. [SOLVED] excel-stacking type within a cell-HOW??
    By TheParaclete in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-10-2005, 08:06 PM

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