6

I am new to VBA 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.

1 Answer 1

10

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
Sign up to request clarification or add additional context in comments.

3 Comments

Hey mate.. Can i ask if you know how to put position in my chart?
What i found is to put .left ="something" and .top = "something" but i didn't manage to do it..
ActiveSheet.Shapes(1).Left = 100 ActiveSheet.Shapes(1).Top = 100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.