LegendKey modification Error

B

Bin

My purpose is to modify legenkey. To change its color,
style, and delete anneccesary ones. I am using follow VB
script

Dataset = 60
for i = 1 to Dataset
ActiveChart.Legend.LegendEntriesi).LegendKey.Border
.ColorIndex = 39
next i

It only works for 30, then show Run-time Error 1004:
Unable to get the Legendkey property of the LegendEntry
class.

There are total 62 data items on the chart. I can manual
modify the item 31 and Macro_recorder shows it is
LegendEntries(31). But it couldn't work using macro. What
is the reason and how to solve it? Thanks.
 
Top