I have a spreadsheet 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>
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>