Hi,
The code bellow, should do the following:
When the Workbook (Report_1.xls), worksheet(Problematic Stock) is for the first accessed in order to create initialy the graph (condition inde<=1) then along with the other things the graph is named "Problematic".
In any other case (after the first chart creation) (condition inde>1) the chart is only being updated.
My problem is that the code : Charts("Problematic").Activate is not working (subscript out of range).
Could you please help me ?
Tzovanis
The code bellow, should do the following:
When the Workbook (Report_1.xls), worksheet(Problematic Stock) is for the first accessed in order to create initialy the graph (condition inde<=1) then along with the other things the graph is named "Problematic".
In any other case (after the first chart creation) (condition inde>1) the chart is only being updated.
My problem is that the code : Charts("Problematic").Activate is not working (subscript out of range).
Could you please help me ?
Tzovanis
Code:
[SIZE=1]Workbooks.Open "C:\Logistics Container\Reports_1.xls"
Workbooks("Reports_1.xls").Activate
Worksheets("Problematic Stock").Activate
Set Sh = Workbooks(backbone).Sheets("Data_Discont")
If inde <= 1 Then
With Charts.Add
.Name = "Problematic"
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = "=[" & backbone & "]Data_Discont!" & Sh.Range(Sh.Cells(4, 1), Sh.Cells(inde + 3, 1)).Address(, , xlR1C1)
.SeriesCollection(1).Values = "=[" & backbone & "]Data_Discont!" & Sh.Range(Sh.Cells(4, 12), Sh.Cells(inde + 3, 12)).Address(, , xlR1C1)
.HasTitle = True
.HasLegend = False
.ChartTitle.Text = "Discontinued Products"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Value"
.Location Where:=xlLocationAsObject, Name:="Problematic"
End With
GoTo 7678
End If
Charts("Problematic").Activate
With ActiveChart
.SeriesCollection(1).XValues = "=[" & backbone & "]Data_Discont!" & Sh.Range(Sh.Cells(4, 1), Sh.Cells(inde + 3, 1)).Address(, , xlR1C1)
.SeriesCollection(1).Values = "=[" & backbone & "]Data_Discont!" & Sh.Range(Sh.Cells(4, 12), Sh.Cells(inde + 3, 12)).Address(, , xlR1C1)
End With
7678[/SIZE]