Problem showing images in locked sheet RRS feed

  • Question

  • I have a spreadsheet in Excel 2007 that displays an image for a result using this event macro I found on McGimpsey & Associates website:

    Private Sub Worksheet_Calculate()
    Dim oPic As Picture
    Me.Pictures.Visible = False
    With Range("b11")
    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

    This works great unless I protect the worksheet and then I get the following error message:

    "Run time error '1004':

    unable to set the Top property of the Picture class"

    I suspect there would be a problem with the Left property too, if it ever got that far.

    I need to protect the sheet because I want to let others (with no excel capabilities) use the sheet without modifying it
    Tuesday, July 5, 2011 1:54 PM

All replies