Hi All,
I have created chart using Excel VBA in the version 2010.
The following is the code. This has been working fine in my system which has 2010.
But, when i tried running this in Excel 2003.Sub create_chart_RCSAnalysis(frm_date As String, to_date As String) Dim lr, ur As Integer Dim WSD As Worksheet Set WSD = Worksheets("Actual-Output") 'Data source Dim CSD As Worksheet Set CSD = Worksheets("Actual-Reports") 'Chart Output lr = find_rowno(frm_date) ur = find_rowno(to_date) If lr = 0 Then MsgBox ("The Inputted From Date is not in the valid Date Range. Please check and try again.") Exit Sub ElseIf ur = 0 Then MsgBox ("The Inputted To Date is not in the valid Date Range. Please check and try again.") Exit Sub Else CSD.Select ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlColumnClustered ActiveChart.Parent.Name = "Chart_RCS_Analysis" ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = "=""Total TC's Introduced""" ActiveChart.SeriesCollection(1).Values = WSD.Range(WSD.Cells(lr, 24), WSD.Cells(ur, 24)) ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(2).Name = "=""Total RCS Introduced""" ActiveChart.SeriesCollection(2).Values = WSD.Range(WSD.Cells(lr, 23), WSD.Cells(ur, 23)) ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(3).Name = "=""No of Testers""" ActiveChart.SeriesCollection(3).Values = WSD.Range(WSD.Cells(lr, 30), WSD.Cells(ur, 30)) ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(4).Name = "=""No of Days""" ActiveChart.SeriesCollection(4).Values = WSD.Range(WSD.Cells(lr, 31), WSD.Cells(ur, 31)) ActiveChart.SeriesCollection(4).XValues = WSD.Range(WSD.Cells(lr, 2), WSD.Cells(ur, 2)) ActiveChart.SeriesCollection(1).Select ActiveChart.SeriesCollection(1).ChartType = xlLine ActiveChart.SeriesCollection(1).Select ActiveChart.SeriesCollection(1).AxisGroup = 2 End If End Sub
I am hitting the "object doesn't support this property" error.
The error is hitting in this line of code.-ActiveSheet.Shapes.AddChart.Select
Please help me to understand whether this is the issue with the Excel versio.
also, please help to get resolved of this issue.
Moderator Note:
Pls use code tags around your code next time as per forum rules.
Bookmarks