Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(ActiveCell, Union(Me.Range("SeriesNames"), Me.Range("SeriesYValues"))) Is Nothing Then
With Me.ChartObjects(1).Chart.SeriesCollection(1)
.Name = "=" & Intersect(ActiveCell.EntireRow, Me.Range("SeriesNames")).Address(, , , True)
.Values = Intersect(ActiveCell.EntireRow, Me.Range("SeriesYValues"))
End With
End If
End Sub
The above code is supposed to change a graph based on a set of numbers in the spreadsheet. However when I try to run it, I get the message "Message 'range' of object'_worksheet failed." I have the the series "Series Names" and "seriesYvalues" spelled out on the spreadsheet