ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Placement of charts (https://www.excelbanter.com/excel-programming/365669-placement-charts.html)

Fabrizio

Placement of charts
 
I am making a macro that generates charts and text that are to be placed on a
new worksheet. I want to be able to write code so that the charts are placed
in a certain way on the new worksheet. I do not know how to write this and it
wont be possible to record a macro for this because I want to be able to
write it in the code so that I can change position easiliy. My code now is:

Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:="Standard"
'ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets(s).Range(rng2.Offset(i,
0).Address & ":" & rng2.Offset(j, 0).Address & "," & rng3.Offset(i,
0).Address & ":" & rng3.Offset(j, 0).Address), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = Sheets(s).Range(rng1.Offset(i,
0).Address, rng1.Offset(j, 0).Address)
ActiveChart.Location Whe=xlLocationAsObject, Name:=x
With ActiveChart
.HasTitle = True
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).HasTitle = True
End With

I dont know where and how to write the code for the placement in the
worksheet. Please help me!


All times are GMT +1. The time now is 07:05 AM.

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