我在vba中有一个简单的公式,如下所示:
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
有人问我,问题是如何解决的?
答案 0 :(得分: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
P.S。应该"跟随H1.xlsx" be" H1.xlsm",或者你有另一本工作簿吗?