[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

Excel 2007 VB To Move & Resize Chart

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
Escanaba
Asked:
Escanaba
  • 4
  • 2
1 Solution
 
nutschCommented:
try adding
    ActiveChart.ChartArea.Left = 150
    ActiveChart.ChartArea.Width = 200

change parameters according to your needs.

Thomas
0
 
EscanabaAuthor Commented:
Thanks, Thomas
How do I get the chart to move down?  
0
 
nutschCommented:
ActiveChart.ChartArea.Top= 150
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
nutschCommented:
you also have .height available
0
 
EscanabaAuthor Commented:
Thank you Thomas!
0
 
nutschCommented:
You're welcome, glad to help.

Thomas
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now