Need help to make a VBA program that extract data and create chart
Printable View
Need help to make a VBA program that extract data and create chart
Why is this posted in "Book Reviews" forum?
Create chart where?
Have you done any research? Made any attempt?
Welcome to VBAX Kamel83. The following will create a chart.
Code:Sub CreateChart()
'Declare variables
Dim rng As Range
Dim cht As Object
'Create a blank chart
Set cht = ActiveSheet.Shapes.AddChart2
'Declare the data range for the chart
Set rng = ActiveSheet.Range("A2:B9") 'Change the range to suit your requirements
'Add the data to the chart
cht.Chart.SetSourceData Source:=rng
'Set the chart type
cht.Chart.ChartType = xlColumnClustered 'Change the Chart type to suit your requirements
End Sub