一旦满足VBA函数条件,我希望函数执行下面的正常excel公式:
=SUMIF('巴克莱-Interest'A:C,CONCATNATE(A1,"-",B1(,'巴克莱-Interest'C:C(
Function RECON (AccountName, Broker, Forex)
If AccountName = "Barclays" Then
RECON = SUMIF('Barclays - Interest'A:C, CONCATENATE(AccountName,"-",Broker),'Barclays - Interest'C:C)
上面的代码是我想要实现的,有什么解决方法吗?(我每次都失败了(理想情况下,我希望保持公式格式不变,这样没有VBA知识的同事就可以根据未来的数据更改轻松地操作它。
创建一个变量来存储工作表名称,并仅引用范围。
Function RECON(AccountName, Broker, Forex)
If AccountName = "Barclays" Then
Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Barclays - Interest")
RECON = Application.WorksheetFunction.SumIf(ws.Range("A:C"), CONCATENATE(AccountName, "-", Broker), ws.Range("C:C"))
'.... More Code
'.... Make sure to END that IF
End Function
您可能还想给RECON
一个变量类型。长的双重的idk。
Function RECON(AccountName, Broker, Forex) as [Variable Type]