T
tskogstrom
Hi,
I gett runtime 1004 at line "HasTitle = True"
The peculiar thing is that yesterday it worked ok. I saved it, slept,
and now I get the error. I have tested to put the Has title ocde in the
end of the sub, after seriescollections etc, but with same results.
Any ideas, anybody?
/Kind regards
tskogstrom
Sub CreateChartCF()
Dim cht As Chart
Dim chtTitle As String
chtTitle = "CashFlow & PayBack"
On Error Resume Next '(if no chartobject)
Sheet2.ChartObjects("R_CF").Delete
On Error GoTo 0
If Sheet1.Range("Years").Value > 1 Then
With Sheet2.ChartObjects.Add(Range("RAPP_BASE_CHT_CF").Left, _
Range("RAPP_BASE_CHT_CF").Top, 468, 260)
.Name = "R_CF"
End With
Set cht = Sheet2.ChartObjects("R_CF").Chart
With cht
.ChartType = xlColumnClustered
.SetSourceData Sheet10.Range("CHT_CFSOURCE_" &
Sheet2.Range("RAPP_TILLF").Value), _
PlotBy:=xlRows
.HasTitle = True
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.ChartTitle.Characters.Text = chtTitle
End With
With cht.SeriesCollection(1)
.Fill.OneColorGradient Style:=msoGradientVertical,
Variant:=4, _
Degree:=0.25
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 47
End With
With cht.SeriesCollection(2)
.Fill.OneColorGradient Style:=msoGradientVertical,
Variant:=4, _
Degree:=0.25
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 45
End With
....etc etc
I gett runtime 1004 at line "HasTitle = True"
The peculiar thing is that yesterday it worked ok. I saved it, slept,
and now I get the error. I have tested to put the Has title ocde in the
end of the sub, after seriescollections etc, but with same results.
Any ideas, anybody?
/Kind regards
tskogstrom
Sub CreateChartCF()
Dim cht As Chart
Dim chtTitle As String
chtTitle = "CashFlow & PayBack"
On Error Resume Next '(if no chartobject)
Sheet2.ChartObjects("R_CF").Delete
On Error GoTo 0
If Sheet1.Range("Years").Value > 1 Then
With Sheet2.ChartObjects.Add(Range("RAPP_BASE_CHT_CF").Left, _
Range("RAPP_BASE_CHT_CF").Top, 468, 260)
.Name = "R_CF"
End With
Set cht = Sheet2.ChartObjects("R_CF").Chart
With cht
.ChartType = xlColumnClustered
.SetSourceData Sheet10.Range("CHT_CFSOURCE_" &
Sheet2.Range("RAPP_TILLF").Value), _
PlotBy:=xlRows
.HasTitle = True
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.ChartTitle.Characters.Text = chtTitle
End With
With cht.SeriesCollection(1)
.Fill.OneColorGradient Style:=msoGradientVertical,
Variant:=4, _
Degree:=0.25
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 47
End With
With cht.SeriesCollection(2)
.Fill.OneColorGradient Style:=msoGradientVertical,
Variant:=4, _
Degree:=0.25
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 45
End With
....etc etc