Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone. I created a macro with the Record New Macro in Excel to
create a chart "Lines on 2 Axes". When I create the chart by hand, all goes well, but when I replay the macro it crashes with the error "Run-time error '1004' Method'Axes' of object'_Chart' failed". Can anyone help me here? I am completely desperate, I don't know what to do. I tried Jon Peltier's answer to this (http://groups.google.com/groups?q=Me...ftngp05&rnum=6) question but it doesn't seem to work for me. Here's my code: Charts.Add ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line - Column on 2 Axes" ActiveChart.SetSourceData Source:=Sheets("Tempo Médio de Espera").Range("A1") ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection.NewSeries 'ActiveChart.SeriesCollection(1).AxisGroup = 3 ActiveChart.SeriesCollection(1).XValues = "='Tempo Médio de Espera'!R4C2:R15C2" ActiveChart.SeriesCollection(1).Values = "='Tempo Médio de Espera'!R4C4:R15C4" ActiveChart.SeriesCollection(1).Name = "='Tempo Médio de Espera'!R3C4" ActiveChart.SeriesCollection(2).Values = "='Tempo Médio de Espera'!R4C6:R15C6" ActiveChart.SeriesCollection(2).Name = "='Tempo Médio de Espera'!R3C6" ActiveChart.SeriesCollection(3).Values = "='Tempo Médio de Espera'!R4C8:R15C8" ActiveChart.SeriesCollection(3).Name = "='Tempo Médio de Espera'!R3C8" ActiveChart.SeriesCollection(4).Values = "='Tempo Médio de Espera'!R4C3:R15C3" ActiveChart.SeriesCollection(4).Name = "='Tempo Médio de Espera'!R3C3" ActiveChart.SeriesCollection(5).Values = "='Tempo Médio de Espera'!R4C5:R15C5" ActiveChart.SeriesCollection(5).Name = "='Tempo Médio de Espera'!R3C5" ActiveChart.SeriesCollection(6).Values = "='Tempo Médio de Espera'!R4C7:R15C7" ActiveChart.SeriesCollection(6).Name = "='Tempo Médio de Espera'!R3C7" ActiveChart.Location Whe=xlLocationAsObject, Name:="Tempo Médio de Espera" With ActiveChart '.SeriesCollection(6).AxisGroup = 2 .HasTitle = True .ChartTitle.Characters.Text = "Evolução Horária Tempo Médio de Espera" .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Espaço Tempo Horário" .Axes(xlValue, xlPrimary).HasTitle = True .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Nº Atendimentos" .Axes(xlCategory, xlSecondary).HasTitle = False .Axes(xlValue, xlSecondary).HasTitle = True .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "Tempo Médio Horário" End With With ActiveChart.Axes(xlCategory) .HasMajorGridlines = False .HasMinorGridlines = False End With With ActiveChart.Axes(xlValue) .HasMajorGridlines = True .HasMinorGridlines = False End With ActiveChart.HasLegend = True ActiveChart.Legend.Select Selection.Position = xlBottom ActiveChart.HasDataTable = False |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | New Users to Excel | |||
Excel 2000 - Pie Chart # of slices | Charts and Charting in Excel | |||
Chart disappears in Excel 2000 | Excel Discussion (Misc queries) | |||
SECOND Y-AXIS IN A BAR CHART, EXCEL 2000?? | Charts and Charting in Excel |