'我在 Excel 工作表的单元格 A6 中使用此公式。它工作正常。
=IF(O6="Hand","人工录入",IF(O6="JET",R6,IF(O6="COKE","红牛",IF(O6="货运","物流",IF (O6="TAX","Tax",IF(O6="TRANSFER COST","Transfer Cost Transactions",IFERROR(IF(FIND("INV#",R6,1)>=1,MID(R6,FIND ("INV#",R6,1),10),""),"")))))))
现在,我的问题是:如何将其转换为 VBA?我试过记录下来,代码如下:
ActiveCell.FormulaR1C1 = _ "=IF(RC[14]=""Hand"",""手动输入 JE"",IF(RC[14]=""JET"",RC[17],IF(RC[ 14]=""COKE"",""红牛"",IF(RC[14]=""FREIGHT"",""物流"",IF(RC[14]=""TAX"","" Tax"",IF(RC[14]=""TRANSFER COST"",""Transfer Cost Transactions"",IFERROR(IF(FIND(""INV#"",RC[17],1)>=1, MID(RC[17],FIND(""INV#"",RC[17]" & _ """""),"""")))))))"
当我运行它时,我收到运行时错误 1004:应用程序定义或对象定义的错误。所以我把它改成了这样,除了 find 选项外,这与上面的公式相同,一切运行正常。![VBA For Above formula][Any Help on the find?] End sub.How do I get the fine option in above VBA code.`