PC Review


Reply
Thread Tools Rate Thread

debug runtime error 1004

 
 
JB Bates
Guest
Posts: n/a
 
      28th Dec 2009
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

 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      29th Dec 2009
Try this

Option Explicit

Private Sub Worksheet_Calculate()
Dim oShape As Shape
Dim myRange As Excel.Range

Set myRange = Me.Range("ad1")

For Each oShape In Me.Shapes
oShape.Visible = msoFalse
Next oShape

For Each oShape In Me.Shapes
If oShape.Type = 13 And _
oShape.Name = myRange.Text Then
oShape.Visible = True
oShape.Top = myRange.Top
oShape.Left = myRange.Left
Exit For
End If
Next oShape
End Sub

--
HTH,

Barb Reinhardt



"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
>

 
Reply With Quote
 
jennifer bates
Guest
Posts: n/a
 
      5th Mar 2010
Hi Barb

I tired this, but the error kicks in, it is when i select the name of a person on worksheet three (as example) that has also been selected on worksheet one.

with the code you suggested, i still get the same error.

any thoughts?



Barb Reinhardt wrote:

Try thisOption ExplicitPrivate Sub Worksheet_Calculate()Dim oShape As ShapeDim
28-Dec-09

Try this

Option Explicit

Private Sub Worksheet_Calculate()
Dim oShape As Shape
Dim myRange As Excel.Range

Set myRange = Me.Range("ad1")

For Each oShape In Me.Shapes
oShape.Visible = msoFalse
Next oShape

For Each oShape In Me.Shapes
If oShape.Type = 13 And _
oShape.Name = myRange.Text Then
oShape.Visible = True
oShape.Top = myRange.Top
oShape.Left = myRange.Left
Exit For
End If
Next oShape
End Sub

--
HTH,

Barb Reinhardt



"JB Bates" wrote:

Previous Posts In This Thread:

On Monday, December 28, 2009 12:13 PM
JB Bates wrote:

debug runtime error 1004
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 do not 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

On Monday, December 28, 2009 7:43 PM
Barb Reinhardt wrote:

Try thisOption ExplicitPrivate Sub Worksheet_Calculate()Dim oShape As ShapeDim
Try this

Option Explicit

Private Sub Worksheet_Calculate()
Dim oShape As Shape
Dim myRange As Excel.Range

Set myRange = Me.Range("ad1")

For Each oShape In Me.Shapes
oShape.Visible = msoFalse
Next oShape

For Each oShape In Me.Shapes
If oShape.Type = 13 And _
oShape.Name = myRange.Text Then
oShape.Visible = True
oShape.Top = myRange.Top
oShape.Left = myRange.Left
Exit For
End If
Next oShape
End Sub

--
HTH,

Barb Reinhardt



"JB Bates" wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Creating a WPF Custom Control
http://www.eggheadcafe.com/tutorials...ustom-con.aspx
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another debug error # 1004 Dave Peterson Microsoft Excel Discussion 9 5th Jul 2009 09:47 PM
Re: Debug error 1004 Jim Cone Microsoft Excel Misc 2 27th Jan 2009 01:47 PM
Re: Debug error 1004 Daniel.C Microsoft Excel Misc 0 27th Jan 2009 12:57 PM
Macro debug - Runtime error 1004 - no data to parse? Chris Microsoft Excel Worksheet Functions 3 7th Apr 2004 11:34 AM
runtime error 1004 Adella Microsoft Excel Programming 2 29th Jul 2003 08:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 PM.