Creating a piechart in excel using VBA
Question
i am new to VB and am trying to learn how to create a pie chart out of certain values on the excel spreadsheet. I know how to do the bar charts but i was wondering whether you guys are aware of online resources or tutorials for this.
Thanks
Solution
Tools
-> Macro
-> Record New Macro
produces this code which you can then tweak to your specific needs:
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:A4"), PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
ActiveChart.HasTitle = False
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow