ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Placement of a chart (https://www.excelbanter.com/charts-charting-excel/217850-placement-chart.html)

PCLIVE[_2_]

Placement of a chart
 
I've got code to add a chart to my worksheet (below).

Range("A1:A10").Select
Charts.Add
ActiveChart.ChartType = xl3DColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Results").Range("A1:A10"),
PlotBy:= _
xlRows
ActiveChart.Location Whe=xlLocationAsObject, Name:="Test"

Now if I want to move that chart, I can use the following code.

ActiveSheet.Shapes("Chart 1").IncrementLeft -63#
ActiveSheet.Shapes("Chart 1").IncrementTop -153#

Is there a way I can specify exactly where I want the left side of the chart
to start. For example, if I want the chart to start where column F starts,
how could I do this?

Thanks,
Paul


PCLIVE[_2_]

Placement of a chart
 
Ok,

I came up with this method.

ActiveSheet.Shapes("Chart 1").Left = ActiveSheet.Columns(6).Left
ActiveSheet.Shapes("Chart 1").Top = ActiveSheet.Rows(1).Top

This starts the left side of the chart at the start of column F, and the Top
side of the chart at the start of Row 1.



"PCLIVE" wrote in message
...
I've got code to add a chart to my worksheet (below).

Range("A1:A10").Select
Charts.Add
ActiveChart.ChartType = xl3DColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Results").Range("A1:A10"),
PlotBy:= _
xlRows
ActiveChart.Location Whe=xlLocationAsObject, Name:="Test"

Now if I want to move that chart, I can use the following code.

ActiveSheet.Shapes("Chart 1").IncrementLeft -63#
ActiveSheet.Shapes("Chart 1").IncrementTop -153#

Is there a way I can specify exactly where I want the left side of the
chart to start. For example, if I want the chart to start where column F
starts, how could I do this?

Thanks,
Paul




All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com