Hi,
Does anyone can share with me how to get the VBA code for excel chart?
Example:
Sub ChartType()
Dim ChtObj As ChartObject
For Each ChtObj In ActiveSheet.ChartObjects
ChtObj.Chart.ChartType = xlColumnClustered
Next ChtObj
End Sub
Question: How to know the chart name? Bar chart, pie chart & etc?
Thank you.
October 5, 2010
Hi,
Are you asking how to find out the chart type for all charts on the active sheet?
Change the For Each loop to this
For Each ChtObj In ActiveSheet.ChartObjects
Debug.Print ChtObj.Chart.ChartType
Next ChtObj
It will print the chart type value/code into the Immediate window. You can get the chart type values from here
https://docs.microsoft.com/en-.....lcharttype
If this relates to a specific problem, please attach the workbook.
Regards
Phil
Answers Post
1 Guest(s)