Hello all,
I would like to start by thanking everyone. I am a "lurker" and don't post often, but has provided some fantastic solutions for my VBA and Excel sheets!!! (As well as the realization that there is much I don't know about programming). Thank you all.
My current problem is changing the size of pie chart. I cannot seem to get the code to recognize the Shape Name, despite naming the chart. I am sure it is something simple that I am overlooking and appreciate any insight. This is the code I am trying to use:
Sub Resizechart()
Range("A1:B3").Select
Charts.Add
ActiveChart.Name = "Breakfast Chart"
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B3"), PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlRight
ActiveSheet.Shapes("Chart 43").ScaleWidth 0.67, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 43").ScaleHeight 1.11, msoFalse, msoScaleFromTopLeft
ActiveWindow.Visible = False
Windows("MyOwnChartMaker.xls").Activate
Range("A6").Select
End Sub
It's finding a common, reproducible name for "Chart 43", since this changes each time I run the macro.
Many thanks.
Tom.
I would like to start by thanking everyone. I am a "lurker" and don't post often, but has provided some fantastic solutions for my VBA and Excel sheets!!! (As well as the realization that there is much I don't know about programming). Thank you all.
My current problem is changing the size of pie chart. I cannot seem to get the code to recognize the Shape Name, despite naming the chart. I am sure it is something simple that I am overlooking and appreciate any insight. This is the code I am trying to use:
Sub Resizechart()
Range("A1:B3").Select
Charts.Add
ActiveChart.Name = "Breakfast Chart"
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B3"), PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlRight
ActiveSheet.Shapes("Chart 43").ScaleWidth 0.67, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 43").ScaleHeight 1.11, msoFalse, msoScaleFromTopLeft
ActiveWindow.Visible = False
Windows("MyOwnChartMaker.xls").Activate
Range("A6").Select
End Sub
It's finding a common, reproducible name for "Chart 43", since this changes each time I run the macro.
Many thanks.
Tom.