小编Aas*_*han的帖子

UDF在任何地方都返回相同的值

我试图在vba中移动平均值编码,但以下各处返回相同的值.

Function trial1(a As Integer) As Variant
    Application.Volatile
    Dim rng As Range
    Set rng = Range(Cells(ActiveCell.Row, 2), Cells(ActiveCell.Row - a + 1, 2))
    trial1 = (Application.Sum(rng)) * (1 / a)
End Function
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba with-statement udf

3
推荐指数
1
解决办法
601
查看次数

标签 统计

excel ×1

excel-vba ×1

udf ×1

vba ×1

with-statement ×1