jamiguel77
Active Member
- Joined
- Feb 14, 2006
- Messages
- 387
- Office Version
- 2016
- 2010
- 2007
- Platform
- Windows
- Web
Hi i have this code that create a chart nto a workbook:
Set rng = Range("A24:B26")
Set cht = NewSheet.ChartObjects.Add( _
Left:=200, _
Width:=370, _
Top:=290, _
Height:=260)
'cht.Chart.ChartType = xlPie
cht.Chart.SetSourceData Source:=rng
'cht.Chart.ChartType = xlPie
cht.Chart.ChartType = xlDoughnut
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Actual"
'cht.Chart.SetElement msoElementDataLabelBestFit
cht.Chart.SetElement msoElementDataLabelCallout
cht.Chart.Name = "Actual"
i have other 3 charts...
Tha chart name is Unique.....
i need declare this variable:
Dim MyChart As Chart
But how to assign the Chart: cht.Chart.Name = "Actual" to my variable: MyChart ?
thanks
Set rng = Range("A24:B26")
Set cht = NewSheet.ChartObjects.Add( _
Left:=200, _
Width:=370, _
Top:=290, _
Height:=260)
'cht.Chart.ChartType = xlPie
cht.Chart.SetSourceData Source:=rng
'cht.Chart.ChartType = xlPie
cht.Chart.ChartType = xlDoughnut
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Actual"
'cht.Chart.SetElement msoElementDataLabelBestFit
cht.Chart.SetElement msoElementDataLabelCallout
cht.Chart.Name = "Actual"
i have other 3 charts...
Tha chart name is Unique.....
i need declare this variable:
Dim MyChart As Chart
But how to assign the Chart: cht.Chart.Name = "Actual" to my variable: MyChart ?
thanks