![]() |
Charts.add error
Im trying to add a chart using a macro and I keep getting the following
message: Method 'Add' of object 'sheets' failed error. What is wrong with the code below? Charts.Add ActiveChart.ChartType = xlLineMarkers ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C45:G45"), PlotBy _ :=xlRows ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R1C2:R1C8" ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1" With ActiveChart .HasTitle = False .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With End Sub Thanks in advance for any help...... |
Charts.add error
The error occurs on the very first line. For some reason Excel is in a state
where it cannot add a sheet, but can't tell why from the code you sent since whatever it is that is preventing it was set before you even get to this line. The workbook might be protected or you might be in the middle of doing something else that prevents Excel from being able to add the chart. -- - K Dales "Ribeye" wrote: Im trying to add a chart using a macro and I keep getting the following message: Method 'Add' of object 'sheets' failed error. What is wrong with the code below? Charts.Add ActiveChart.ChartType = xlLineMarkers ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C45:G45"), PlotBy _ :=xlRows ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R1C2:R1C8" ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1" With ActiveChart .HasTitle = False .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With End Sub Thanks in advance for any help...... |
All times are GMT +1. The time now is 02:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com