View Full Version : Create Chart by VBA
Kamel83
12-05-2023, 09:41 AM
Need help to make a VBA program that extract data and create chart
June7
12-05-2023, 10:04 AM
Why is this posted in "Book Reviews" forum?
Create chart where?
Have you done any research? Made any attempt?
Aussiebear
12-05-2023, 01:58 PM
Welcome to VBAX Kamel83. The following will create a chart.
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
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.