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.
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-us/office/vba/api/excel.xlcharttype
If this relates to a specific problem, please attach the workbook.
Regards
Phil
Thank you Phil. Yes i am looking for excel chart type enumeration in VBA. The link that you sent is very useful. thank you.