Update Chart by column
Not sure if you want to only want one series at any one time on the chart,
or merely highlight the next of your series of the 5. This does the latter.
Sub Test()
Dim sr As Series
Dim scol As SeriesCollection
Static serHighlit As Long
On Error GoTo errH
Application.ScreenUpdating = False
If TypeOf ActiveSheet Is Worksheet Then
'' Worksheet chart
Set scol = ActiveSheet.ChartObjects(1).Chart.SeriesCollection
Else
'' chart-sheet
Set scol = ActiveSheet.SeriesCollection
End If
If serHighlit = scol.Count Then serHighlit = 0
serHighlit = serHighlit + 1
For Each sr In scol
sr.Border.Weight = 1
sr.Border.ColorIndex = xlNone 'xlAutomatic
Next
scol(serHighlit).Border.ColorIndex = xlAutomatic '3
scol(serHighlit).Border.Weight = 4
errH:
Application.ScreenUpdating = True
If Err.Number Then
MsgBox "error"
End If
End Sub
If you want all 5 series visible on the chart, change the pair of colorindex
values to the commented pair.
Regards,
Peter T
"VH" wrote in message
...
I want a chart to update so that I can se either next column or previous
column in the chart. I want the user to push a commandbutton (next column
or
previous column) to see data from one column at the time. The first column
is
the x- values and the rest is the y- values.
FYI: The X- values are the time axis. The rest of the columns are logdata.
The point is to see how the logdata varies.
X Y1 Y2 Y3 Y4
Y5
0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81
|