需要帮助将此Excel功能写入宏,请帮助
A1 = 7 B1 = 1 C1 = 4
A2 = 8 B2 = 2 C2 = 5
A3 = 9 B3 = 3 C3 = 6
如果A1 = A1(7),则答案将等于B1 * C1 = 1 * 4 = 4
如果A1 = A2(8),则答案将等于B2 * C2 = 2 * 5 = 10
该功能在excel单元格中完美运行,
SUMPRODUCT((A1:A3=A1)+0,B1:B3,C1:C3)
然而,vba并不起作用。
With Worksheets("Sumproduct")
.Range("D1").Value = Application.WorksheetFunction.SumProduct((.Range("A1:A3" = A1)+ 0 , .Range("B1:B3"), .Range("C1:C3"))`