2017-04-11 45 views
0

我有一個簡單的公式在VBA中,像這樣的:已經運行時錯誤1004應用程序定義或對象定義的錯誤

Sub button_fu() 

Windows("H1.xlsm").Activate 
Sheets("jan").Activate 
Range("J3").Select 

Range("J3").Formula = "=IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,8,False))=1,""terhubung"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,9,False))=1,""unreach"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,10,False))=1,""reject"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,11,False))=1,""workload"","""")" 

End Sub 

人HEPL我來說,問題是如何解決的呢?

回答

0

你缺少你公式中的一些閉幕括號:

Sub button_fu() 

    Windows("H1.xlsm").Activate 
    Sheets("jan").Activate 
    Range("J3").Select 

    Range("J3").Formula = "=IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,8,False))=1,""terhubung"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,9,False))=1,""unreach"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,10,False))=1,""reject"",IF((VLOOKUP(C3,'[FOLLOW UP H1.xlsx]jan'!$C$8:$M$100,11,False))=1,""workload"",""""))))" 

End Sub 

附:應該「跟上H1.xlsx」是「H1.xlsm」,還是你有另一個工作簿?

相關問題