|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我想通过数组计算选定区域每行的最大值 减 最小值 的平均值后除以一个系数,得到具体的值 ,但在用FOR语句给数组赋值 ,就是要出错。烦请高手指点一下以下内容中错哪了?跪谢!
Function stdevz(ParamArray rng() As Variant) As Variant
Dim rang As Range, rngi As Range, T As Single, F As Single, i As Integer
Dim trr()
Dim arr()
For Each R In rng
If rang Is Nothing Then Set rang = R Else Set rang = Union(rang, R)
For Each c In R
Next
Next
n = rang.Cells.Count
aa = rang.Columns.Count '列数
bb = rang.Rows.Count '行数
For i = 1 To bb
Set rngi = rang(i, 1).Resize(1, aa)
arr(i) = Application.Max(rngi.Value) - Application.Min(rngi)
Next
F = pplication.WorksheetFunction.Average(arr)
trr = [{0,1.128,1.693,2.059,2.326,2.534,2.704,2.847,2.97,3.078}]
T = trr(5)
stdevz = F / T
End Function
|
|