Solved

Excel 2007 VB To Move & Resize Chart

Posted on 2009-06-30
6
653 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now