2017-06-13 42 views
-3

我寫了1個文件VBA宏Excel。 首先,我記錄。該命令是確定的。 但是當我運行這段代碼我得到一個錯誤:錄製後,我無法運行此代碼

Error 1004 "Application-defined or Object-defined error

這裏是我的命令:

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

您聲明的最後部分已損壞。您有:

... +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"