Results 1 to 4 of 4

Add exception to a macro displaying pictures

Threaded View

  1. #1
    Registered User
    Join Date
    02-15-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    42

    Add exception to a macro displaying pictures

    Hello everyone,

    I'd like to ask for your help regarding a project on Excel.

    What it does:

    If Cell value in "C36" or "D36" is Yes, then a picture will be displayed (either Picture 1 or Picture 2).
    If Cell value is No, then the pictures won't be displayed.

    The code I use:

    Private Sub Worksheet_Calculate()
    Dim oPic As Picture
    Me.Pictures.Visible = False
    With Range("C36")
    For Each oPic In Me.Pictures
    If oPic.Name = .Text Then
    oPic.Visible = True
    oPic.Top = .Top
    oPic.Left = .Left
    Exit For
    End If
    Next oPic
    End With
    With Range("D36")
    For Each oPic In Me.Pictures
    If oPic.Name = .Text Then
    oPic.Visible = True
    oPic.Top = .Top
    oPic.Left = .Left
    Exit For
    End If
    Next oPic
    End With
    End Sub

    My problem:

    By default, all pictures on the Excel sheet are invisible.
    My problem is, there are 3 pictures I'd like to display at all time because they are part of the document's decoration.

    Therefore, I'd like to add an exception for the Picture A, Picture B, Picture C so they are not affected by the command "Me.Pictures.Visible = False".



    Please may I ask if someone could help me and advise which code I should use?

    Please let me know if you need more information.
    Thank you very much in advance.

    NOTE:
    Since the forum's rules require me to provide a link in case I asked the same question on a different forum, here it is. That was before I could find this forum.
    Last edited by DreamEyes; 02-15-2014 at 02:33 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Creating an exception for a macro button.
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2012, 02:17 PM
  2. Macro Delete Duplicate Rows with Exception
    By smmeader in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-20-2012, 12:37 AM
  3. Displaying multiple PDF pictures based on two cell values.
    By BarelyCivil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2011, 12:37 PM
  4. Make macro exception if data in field
    By Mechroneal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2007, 07:04 PM
  5. Excel Exception handling Macro
    By coder_arun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2006, 09:00 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