我写了1个文件VBA Macro Excel。 首先,我记录。命令没问题。 但是,当我运行此代码时,我收到一个错误:
错误1004“应用程序定义或对象定义的错误
这是我的命令:
SUMIFS(CSDL4G!F:F,CSDL4G!D:D,'KPI Huyen'!B47)*SUMIFS(CSDL4G!H:H,CSDL4G!D:D,'KPI Huyen'!B47)*(SUMIFS(CSDL4G!J:J,CSDL4G!D:D,'KPI Huyen'!B47)+SUMIFS(CSDL4G!L:L,CSDL4G!D:D,'KPI Huyen'!B47))/SUMIFS(CSDL4G!E:E,CSDL4G!D:D,'KPI Huyen'!B47)/SUMIFS(CSDL4G!G:G,CSDL4G!D:D,'KPI Huyen'!B47)/(SUMIFS(CSDL4G!I:I,CSDL4G!D:D,'KPI Huyen'!B47)+SUMIFS(CSDL4G!K:K,CSDL4G!D:D,'KPI Huyen'!B47))*100
这是我的代码:
ActiveCell.FormulaR1C1 = _
"=SUMIFS(CSDL4G!C[-1],CSDL4G!C[-3],'KPI Huyen'!RC[-5])*SUMIFS(CSDL4G!C[1],CSDL4G!C[-3],'KPI Huyen'!RC[-5])*(SUMIFS(CSDL4G!C[3],CSDL4G!C[-3],'KPI Huyen'!RC[-5])+SUMIFS(CSDL4G!C[5],CSDL4G!C[-3],'KPI Huyen'!RC[-5]))/SUMIFS(CSDL4G!C[-2],CSDL4G!C[-3],'KPI Huyen'!RC[-5])/SUMIFS(CSDL4G!C,CSDL4G!C[-3],'KPI Huyen'!RC[-5])/(SUMIFS(CSDL4G!C[2],CSDL4G!C[-3],'KPI Huyen'!RC[-5])+S" & _
"DL4G!C[4],CSDL4G!C[-3],'KPI Huyen'!RC[-5]))*100"
请帮我解决这个问题。谢谢!
答案 0 :(得分:0)
声明的最后部分已损坏。你有:
... +S" & _
"DL4G!C[4],CSDL4G!C[-3],'KPI Huyen'!RC[-5]))*100"
但应该是
... +SUMIFS(CS" & _
"DL4G!C[4],CSDL4G!C[-3],'KPI Huyen'!RC[-5]))*100"