Solved

Excel 2007 VB To Move & Resize Chart

Posted on 2009-06-30
6
656 Views
Last Modified: 2013-11-26
Hello Experts,

What do I need to modify on the attached code that will capture moving and resizing a chart?  When I look at the macro recorder it only comes up with:
    ActiveSheet.ChartObjects("Chart 6").Activate
    ActiveChart.ChartArea.Select
    ActiveSheet.ChartObjects("Chart 6").Activate
Which generates a 'cannot find defined name' error.  I'm trying to slide the chart to the left and expand it's width.
Thanks
Sheets("Report").Select
    Range("A27").Select
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Pivot Table Data").Range("A25:B42")
    ActiveChart.Legend.Select
    Selection.Delete
    ActiveChart.SetElement (msoElementChartTitleAboveChart)
    ActiveChart.ChartTitle.Text = "% of Time"
    ActiveChart.Axes(xlValue).Select
    Selection.TickLabels.NumberFormat = "0%"
    ActiveChart.SetElement (msoElementDataLabelOutSideEnd)

Open in new window

0
Comment
Question by:Escanaba
  • 4
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 24749651
try adding
    ActiveChart.ChartArea.Left = 150
    ActiveChart.ChartArea.Width = 200

change parameters according to your needs.

Thomas
0
 
LVL 1

Author Comment

by:Escanaba
ID: 24749818
Thanks, Thomas
How do I get the chart to move down?  
0
 
LVL 39

Expert Comment

by:nutsch
ID: 24749822
ActiveChart.ChartArea.Top= 150
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 39

Expert Comment

by:nutsch
ID: 24749827
you also have .height available
0
 
LVL 1

Author Closing Comment

by:Escanaba
ID: 31598549
Thank you Thomas!
0
 
LVL 39

Expert Comment

by:nutsch
ID: 24749924
You're welcome, glad to help.

Thomas
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question