Setting position of AutoShape Item

specs

New Member
Joined
Oct 26, 2005
Messages
27
Hi there,

Is there any way to set the position of the yellow point of the autoshape in the picture. So that it will always be at the position of the last point of the trend chart, which is the blue dot. Maybe any1 knows how to obtain the axis position of the last blue dot in my chart, that would slove my problem too.

shape.JPG



As far as i know, i can only set the position of the yellow dot by these two lines, the numbers are controling the x and y axis.
Selection.ShapeRange.Adjustments.Item(1) = 0.9613
Selection.ShapeRange.Adjustments.Item(2) = -0.3333
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Had a poke around.
Doesn't look like it is possible directly. Shapes are handled on screen using Top/Left/Height & Width properties. There does not seem to be any way of getting the co-ordinates of a point on a graph.

The autoshape "box" itself does have these properties, however the callout "yellow spot" seems to be relative to the callout base. Here is something to play with. It uses the co-ordinates of a cell to move the autoshape around. In this case perhaps a suitable one underneath the chart.
Code:
Sub test()
    Dim MyCell As Range
    Dim MyShape As ShapeRange
    '----------------------------------------------
    'Set MyCell = ActiveCell ' alternative test
    Set MyCell = ActiveSheet.Range("a4")
    Set MyShape = ActiveSheet.Shapes.Range("AutoShape 1")
    With MyShape
        .Top = MyCell.Top
        .Left = MyCell.Left
        .ZOrder msoBringToFront
    End With
End Sub
 
Upvote 0
Thanks guys for your replies.

Just a slight question on BrianB's code suggestion:

Code:
Set MyCell = ActiveSheet.Range("a4")

so what data should be in Range("a4") and to be set into MyCell?
is the Range("a4") in Sheet1 for example?
 
Upvote 0
so what data should be in Range("a4")
Any data. In this case the cell is just used as a marker to set the position of the shape (which uses the screen co-ordinates of the cell). The idea here is to choose a suitable cell on the "grid" rather than using trial and error.

Top left of the window has co-ordinates 0,0.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top