Stepping Problem,

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know I posted this earlier, but the response I recieved did not help any.
Though I did appreciate the response.

Stepping through a program will achieve the desired results, but running it
normally will error out.

First, a Worksheet Change Event is recieved, this in turns calls a Sub to
add an AutoShape to a worksheet.
If code is allowed to run normally I will always recieve a
1004 Application-Defined or Object Defined error at the line that actually
ADDS the shape

Set sh = wks.Shapes.AddShape(msoShapeDownArrow, 354.75, 162 + (rown * 21),
24, 30)

wks is passed as an argument to the sub from the worksheet change event and
sh is a shared public variable as Shape

when stepping the code does not error out.
Anyone know why this might be doing so?
 
Try this, I take it rown is the row number
this worked fine for me

Dim shp As Shape

Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal Target As Range)

Set shp = sh.Shapes.AddShape(msoShapeDownArrow, 354.75, 162 +ActiveCell.Row
* 21, 24, 30)

End Sub
 
your code works well,
but shape is not visible.
so "shp.Visible = msoTrue" is required

Best regards
sjoo
 
This question was actually finally presented with a work around in a previous
post, it seems that other people have add this issue and had to have excel
Select something else (doesn't matter what) before creating the shape.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top