.Left函数中断For循环并停止子程序

时间:2015-09-10 20:27:18

标签: excel vba charts

我想将数据标签移到右侧,我收到了参考错误。

    For Each MyNewSrs In myChtObj.Chart.SeriesCollection
       With MyNewSrs.Points(1).DataLabel
           .Left = 400
       End With
    Next MyNewSrs

.Left = 400行停止子。当我用F8进入它时它工作得很好。我尝试了DoEventsSleep 1000,但它仍然不允许DataLabels移动。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

    myChtObj.Activate
    For Each MyNewSrs In myChtObj.Chart.SeriesCollection
        With MyNewSrs.Points(1).DataLabel
             .Left = 400
        End With
    Next MyNewSrs