Monique has attended:
Excel VBA Intro Intermediate course
Excel Charts using VBA
Is it possible to create charts in Excel using VBA. For example, having created a PivotTable in VBA with yearly totals, can you plot a chart of these values?
RE: Excel Charts using VBA
You can do almost anything in VBA that you can do as an Excel user. The easiest way to find out how the code will look is to record the code of producing the chart and then take a look at the code and work from there.
I recorded creating a chart from a pivot table and got the following code. My pivot table was on Sheet4 and A6 was inside it.
Sub Macro2()
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Sheet4").Range("A6")
ActiveChart.Location Where:=xlLocationAsNewSheet
End Sub
Formatting the chart to appear as you need is another record a macro and see what it does and tweak it to suit your needs.
Laura GB