|
Function Ssumif(r, v, c)
Application.Volatile
Dim arr, i, s, arr2
arr = Split(r, "!")
arr2 = Split(c, "!")
Dim index1, index2, shtarr
shtarr = Split(Replace(arr(0), "'", ""), ":")
Dim wbk As Workbook
Set wbk = Application.ThisCell.Parent.Parent
index1 = wbk.Sheets(shtarr(0)).Index
index2 = wbk.Sheets(shtarr(1)).Index
For i = index1 To index2
s = Application.SumIf(wbk.Sheets(i).Range(arr(1)), v, wbk.Sheets(i).Range(arr2(1)))
If Not IsError(s) Then
Ssumif = s + Ssumif
End If
Next
End Function
这个VBA能帮忙改一下吗?
希望的公式= SSUMIF("'1:zumi'!A:A",V,"B:B")
现在的公式=Ssumif("'1:zumi'!A:a",A2,"b:b!b:B")
|
|