Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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...... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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...... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Abstracting Error Bar Data From Charts | Charts and Charting in Excel | |||
charts.add error | Excel Discussion (Misc queries) | |||
Percentage rounding error in charts | Excel Discussion (Misc queries) | |||
Exporting charts as GIF - error | Excel Programming | |||
Exporting charts as GIF - error | Excel Programming |