+ Reply to Thread
Results 1 to 3 of 3

Show 2 different pictures depending on value of cell

  1. #1
    Registered User
    Join Date
    03-22-2014
    Location
    Manila
    MS-Off Ver
    Excel 2003
    Posts
    25

    Show 2 different pictures depending on value of cell

    Hi,

    I have "Picture 1" and "Picture 2" and 3 cells involved

    Cell G3 - Field that accepts name
    Cell L3 - Contains comparison name/correct name spelling.
    Cell M3 - Has =IF(G3=L3,1,0)

    How can I do it that if "M3" returns "1" then Show "Picture 1" and if "M3" returns "0" then Show "Picture 2"?

    And how can it be toggled to after to hide the picture to try the activity again. It's a spelling tool that shows a 2 different images if correct or incorrect spelling was made.

    Thank you!

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Show 2 different pictures depending on value of cell

    I'd have 3 pictures, the two you currently have and a 3rd which is blank and the same colour as the sheet background. You have all 3 pictures exactly the same size and in the exact same position on the page. Then you use Selection.ShapeRange.ZOrder (msoBringToFront) to bring whichever image is required to the front, ie visible with the other 2 hidden behind it.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Show 2 different pictures depending on value of cell

    Hi paradoxofthecat,

    See the attached file which contains the following Macro code. Since VBA is used, your formula in cell 'M3' is not needed to display the appropriate picture which is visible for one second. Each time the value of cell 'G3' changes (after the cell loses focus) one of the pictures is displayed.

    If you have additional cells that need to display or hide pictures, the code can be easily adapted to handle those other cells.

    Sheet1 module code:
    Please Login or Register  to view this content.
    Ordinary module code such as Module1:
    Please Login or Register  to view this content.
    To enable Macros and to Run Macros see the following:
    http://office.microsoft.com/en-us/ex...010031071.aspx
    http://office.microsoft.com/en-us/ex...010014113.aspx
    http://office.microsoft.com/en-us/tr...001150634.aspx
    If help is still needed do a google search for 'youtube excel enable macro' and/or 'youtube excel run macro'.

    To access Visual Basic (VBA) see:
    http://www.ablebits.com/office-addin...a-macro-excel/
    a. Click on any cell in the Excel Spreadsheet (may not be needed).
    b. ALT-F11 to get to VBA.
    c. CTRL-R to get project explorer (if it isn't already showing).
    d. Double Click on a 'Module Name' in 'Project Explorer' to see code for that module.

    Lewis

+ 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. Show help message depending on selected cell
    By bubusi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2015, 03:21 AM
  2. How to show/hide row depending on cell value?
    By Haze1434 in forum Excel General
    Replies: 3
    Last Post: 03-03-2014, 06:10 PM
  3. Digital Signatures - Move "pictures" depending on certain cell value
    By J0ck3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2013, 08:25 AM
  4. Replies: 1
    Last Post: 08-12-2010, 04:36 PM
  5. Replies: 1
    Last Post: 04-11-2008, 02:02 AM
  6. Show pictures in excel depending of a choice!
    By petterss in forum Excel General
    Replies: 1
    Last Post: 08-02-2006, 06:50 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