如图,比如要在C1:C9写入公式,代码为:
Sub DD()Dim I As IntegerFor I = 1 To 9 Range("C" & I).Value = "=sumif(a1:a9," & "a" & I & ",b1:b9)"NextEnd Sub