Macro to move unspecified chart

G

Guest

Hi



I have a macro that creates a chart, it does this well! What it doesnt do
well is place it where i want it once it is created.

The problem is that the code to move it about the page that i have:

ActiveSheet.Shapes("Chart 18").IncrementLeft 251.25
ActiveSheet.Shapes("Chart 18").IncrementTop -129.75


....obviously specifies that the chart that will be moved must be "Chart 18".
Is there anyway round this? With the amount of users this sheet is going to
have, i cannot guarantee that when the button is pressed, the chart that it
will fire will be the 18th!

Surely there must be a way of shifting it once you are already into
"ActiveChart. "?
For example, does "ActiveChart.Move" only shift between sheets?


Any help gratefully recieved, please let me know if you need more info


cheers


jb
 
B

Bob Flanagan

You can do this if it is the last chart:

ActiveSheet.Shapes(ActiveSheet.Shapes.Count).IncrementLeft 251.25

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
G

Guest

cheers Bob


works like a charm

Bob Flanagan said:
You can do this if it is the last chart:

ActiveSheet.Shapes(ActiveSheet.Shapes.Count).IncrementLeft 251.25

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
J

Jon Peltier

Alternatively:

ActiveChart.Parent.IncrementLeft 251.25

To set an absolute position:

ActiveChart.Parent.Left = 200

- Jon
 

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

Top