1

这是一个非常简单的问题......我只是卡在语法上。

如何更改此公式以使其 vba 合法:

    Dim sum_rng As Range
    Set sum_rng = Range(Cells(strt_pt(end_ct), j), Cells(end_pt(end_ct), j))
    'Debug.Print sum_rng

    Cells(47, lent + 2).Formula = "=AVERAGE(IF(ISNUMBER(" & sum_rng & ")," & sum_rng & ")"

数组和其他一切看起来都很好,我认为问题是 .Formula 与 .FormulaR1C1 或其他东西。

4

1 回答 1

1

我认为你缺少一个括号。见最后一行的结尾

Dim sum_rng As Range
Set sum_rng = Range(Cells(strt_pt(end_ct), j), Cells(end_pt(end_ct), j))
'Debug.Print sum_rng

Cells(47, lent + 2).Formula = "=AVERAGE(IF(ISNUMBER(" & sum_rng & ")," & sum_rng & "))"
于 2013-09-24T12:56:32.540 回答