ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Control charts through VBA (https://www.excelbanter.com/charts-charting-excel/127796-control-charts-through-vba.html)

Fredrik E. Nilsen

Control charts through VBA
 
Hi,

First of all; thanks for all the help I have got from this group
already. I'm still experimenting with controlling charts through VBA.
I'm trying to controll the sizing of the chart object and elements of
the chart and to apply formatting based on user-defined charts in
xlusrgal.xls. This is what I've got so far:

Sub Diagram1()
If Not ActiveChart Is Nothing Then
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
"Linje1"
ActiveWorkbook.Colors = Workbooks("XLUSRGAL.XLS").Colors
With ActiveChart.Parent
.Height = 252.75
.Width = 342.75
End With
With ActiveChart.PlotArea
.Height = 204
.Width = 340
.Top = 20
End With
With ActiveChart.Legend
.Left = 0
.Top = 250
End With
Else
MsgBox "Du må merke et diagram før du utfører denne
handlingen.", _
vbExclamation, "Ingen diagram merket"
End If
End Sub

I must admit that I don't understand all of the syntax and I guess
that there are better ways to accomplish this?

--
Fredrik E. Nilsen


All times are GMT +1. The time now is 02:29 PM.

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