-1

我无法用以下代码弄清楚为什么我会收到错误 13 - 更具体地说是在第 8 行 (dStDev = Round(Application.StDev(rngGrainSummary), 3))

    Dim i As Long                   'generic counter
Dim nColumns As Long            'number of grain sizes to plot
Dim iSeries As Series           'i-th series
Dim nSeries As Long             'total number of series
Dim rngIDNode As Range          'ID node of data worksheet
Dim rngGrainSummary As Range    'range including all current grain size data
Dim rngLimitNode As Range       'last specification cell of data worksheet


  'find the stats by moving rngGrainSummary right incrementally
'rounding necessary due to constraint on string length of absolutely assigned y values
For i = 1 To nColumns
    Set rngGrainSummary = rngGrainSummary.Offset(0, 1)
    dMean(i) = Round(Application.Average(rngGrainSummary), 3)
    dMax(i) = Round(Application.Max(rngGrainSummary), 3)
    dMin(i) = Round(Application.Min(rngGrainSummary), 3)
    dStDev = Round(Application.StDev(rngGrainSummary), 3)
    dStDevAbove(i) = dMean(i) + dStDev
    dStDevBelow(i) = dMean(i) - dStDev
Next

我不确定我还能添加什么对大家有帮助的东西。请帮忙!

谢谢,马特

4

2 回答 2

0

也许 StDev 返回错误值而不是 Double

于 2013-06-06T06:08:12.533 回答
0

rngGrainSummary 至少需要两组数据来解释。代码工作正常。

于 2013-06-12T07:52:26.477 回答