Results 1 to 4 of 4

Hiding / unhiding pictures based on cell value

Threaded View

supern0va Hiding / unhiding pictures... 08-14-2012, 10:52 AM
patel45 Re: Hiding / unhiding... 08-14-2012, 11:43 AM
supern0va Re: Hiding / unhiding... 08-14-2012, 11:56 AM
supern0va Re: Hiding / unhiding... 08-14-2012, 12:00 PM
  1. #1
    Registered User
    Join Date
    02-05-2011
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    56

    Hiding / unhiding pictures based on cell value

    Hi,

    The last few days I've been working on a multiple choice quiz in excel.
    I have a working version that picks questions from a column and answers from another, and presents it to the user. See attached.

    Now I want the questions for chapter 1 to be pictures instead of text. I added some dummy pics in the doc I attached.
    I used this tutorial.
    It is supposed to hide all pictures and then display one on a specified location [U]if[U] that picture's name corresponds to a cell value (which is a vlookup formula).

    But I get an error on the following line
     For Each oPic In Me.Pictures
    Run-time error '13': Type mismatch

    Complete code for that sub:
    (Me.pictures.visible should be false. Is still true in attached doc.)

        Private Sub Worksheet_Calculate()
    
            Dim oPic As Picture
            Me.Pictures.Visible = False
            With Worksheets("Quiz").Range("L2")
                For Each oPic In Me.Pictures
                    If oPic.Name = .Text Then
                        oPic.Visible = True
                        oPic.Top = .Top
                        oPic.Left = .Right
                        Exit For
                    End If
                Next oPic
            End With
        End Sub
    Does anyone see what I'm doing wrong?
    Attached Files Attached Files
    Last edited by supern0va; 08-14-2012 at 10:57 AM. Reason: remark: pics instead of text only for chapter 1!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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