Hello,
I am trying to adjust a working active cell chart and that changes depending on the cell selected. I want to add a second series based on a table from Sheet 3. The second table is the same as the first in terms of format but the only difference is the numbers. The second series is listed as tSeries and the second row is called AnotherRow. This what I have so far.
Sub UpdateChart2()
*
Dim oChtObj As ChartObject
*
Dim oSeries As Series
*
Dim tSeries As Series
*
Dim UserRow As Long
*
Dim AnotherRow As Long
*
*
Set oChtObj = ActiveSheet.ChartObjects(1)
*
On Error Resume Next
*
UserRow = ActiveCell.Row
*
AnotherRow.
*
If UserRow < 4 Or IsEmpty(Cells(UserRow, 1)) Then
*
oChtObj.Visible = False
*
*
Else
*
With oChtObj
With .Chart
If .SeriesCollection.Count = 0 Then
Set oSeries = .SeriesCollection.NewSeries
Set tSeries = .SeriesCollection.NewSeries
*
*
Else
*
Set oSeries = .SeriesCollection(1)
Set tSeries = .SeriesCollection(2)
*
End If
*
tSeries.Values = Range(Cells(AnotherRow, 2), Cells(AnotherRow, 13))
oSeries.Values = Range(Cells(UserRow, 2), Cells(UserRow, 13))
.HasTitle = True
.ChartTitle.Text = Cells(UserRow, 1).Text
.ChartType = xlLine
*
*
End With
*
.Visible = True
*
*
End With
*
End If
*
*
*
*
*
oSeries.XValues = Worksheets("Sheet1").Range("B17:M17")
*
oSeries.Border.Weight = xlThick
oSeries.Border.LineStyle = xlContinuous
oSeries.Smooth = True
tSeries.XValues Worksheets("Sheet3").Range("B17:M17")
tSeries.Border.Weight = xlThick
tSeries.Border.LineStyle = xlContinious
tSeries.Smooth = True
*
*
*
*
*
*
*
oChtObj.Visible = True
*
*
*
End Sub
*
I am trying to adjust a working active cell chart and that changes depending on the cell selected. I want to add a second series based on a table from Sheet 3. The second table is the same as the first in terms of format but the only difference is the numbers. The second series is listed as tSeries and the second row is called AnotherRow. This what I have so far.
Sub UpdateChart2()
*
Dim oChtObj As ChartObject
*
Dim oSeries As Series
*
Dim tSeries As Series
*
Dim UserRow As Long
*
Dim AnotherRow As Long
*
*
Set oChtObj = ActiveSheet.ChartObjects(1)
*
On Error Resume Next
*
UserRow = ActiveCell.Row
*
AnotherRow.
*
If UserRow < 4 Or IsEmpty(Cells(UserRow, 1)) Then
*
oChtObj.Visible = False
*
*
Else
*
With oChtObj
With .Chart
If .SeriesCollection.Count = 0 Then
Set oSeries = .SeriesCollection.NewSeries
Set tSeries = .SeriesCollection.NewSeries
*
*
Else
*
Set oSeries = .SeriesCollection(1)
Set tSeries = .SeriesCollection(2)
*
End If
*
tSeries.Values = Range(Cells(AnotherRow, 2), Cells(AnotherRow, 13))
oSeries.Values = Range(Cells(UserRow, 2), Cells(UserRow, 13))
.HasTitle = True
.ChartTitle.Text = Cells(UserRow, 1).Text
.ChartType = xlLine
*
*
End With
*
.Visible = True
*
*
End With
*
End If
*
*
*
*
*
oSeries.XValues = Worksheets("Sheet1").Range("B17:M17")
*
oSeries.Border.Weight = xlThick
oSeries.Border.LineStyle = xlContinuous
oSeries.Smooth = True
tSeries.XValues Worksheets("Sheet3").Range("B17:M17")
tSeries.Border.Weight = xlThick
tSeries.Border.LineStyle = xlContinious
tSeries.Smooth = True
*
*
*
*
*
*
*
oChtObj.Visible = True
*
*
*
End Sub
*