Runtime Error 1004
On Dec 24, 11:46*am, JB Bates
wrote:
I have a workbook that contains 100 worksheets. *On each work sheet I have
the following code (see below) that runs and when a particular person is
selected from a drop down list a jpg of their signature displays at the top
of each sheet. *
This was working fine but I am now getting the following error after I
select a person from the drop down and then when ever i try to input data
into any other cell. *The error message is:
Runtime Error '1004'" Unable to set the top property of the picture class
It then allows me to END or debug. *if i select debug it opens the VBA
window to the code and highlights this line
oPic.Top = .Top
But i don't know what to to do with that line of code to debug
PLEASE HELP
thanks in advance - JB
* * Private Sub Worksheet_Calculate()
* * * * Dim oPic As Picture
* * * * Me.Pictures.Visible = False
* * * * With Range("ad1")
* * * * * * 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
Try not using...
Dim oPic As Picture
Use instead...
Dim oPic As Shape
However, an extra loop is required so that Shapes other than Pictures
are not hidden...
Private Sub Worksheet_Calculate()
Dim oPic As Shape
For Each oPic In Me.Shapes
If oPic.Type = msoPicture Then
oPic.Visible = False
End If
Next oPic
With Range("ad1")
For Each oPic In Me.Shapes
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub
I have seen this problem before and this solution has usually worked.
I have no idea why use the Picture object should result in the error.
Ken Johnson
|