Hi guys,
I have a table with a large series of data on it and I have it linked to a graph. The problem is that some of the data can be #N/A. I have intentionally made it this way so that these values do not appear on the chart itself. Also, I use check boxes to hide/display data on request. The objective is to have a completely automated graph that updates itself with the selected check boxes.
If the data series name is unchecked, it becomes #N/A as well. It gets removed from the graph but not from the legend. I wrote this script but it gives me:
This is my code:
PLEASE HELP!!!!
I have a table with a large series of data on it and I have it linked to a graph. The problem is that some of the data can be #N/A. I have intentionally made it this way so that these values do not appear on the chart itself. Also, I use check boxes to hide/display data on request. The objective is to have a completely automated graph that updates itself with the selected check boxes.
If the data series name is unchecked, it becomes #N/A as well. It gets removed from the graph but not from the legend. I wrote this script but it gives me:
Code:
Runtime Error 438
Object does not support property or method
This is my code:
Code:
Sub Deleter()
Dim j As Integer
Dim i As Integer
j = ActiveChart.Legend.LegendEntries.Count
MsgBox i
MsgBox j
ActiveChart.Legend.Select
With ActiveChart
For i = 1 To j
.Legend.LegendEntries(i).Select
If .Legend.LegendEntries.Name = "#N/A" Then _
Selection.Delete
Next
On Error Resume Next
End With
End Sub
PLEASE HELP!!!!