我正在执行一个 VB 函数来对不同类别的指定时间段内的累积金额进行排序。目标是人事账户费用。
例如,我在 A 列中的工作表“tmp”中有一些日期,在 B 列中有一个类别(例如薪水,运输......),在 C 列中有值。
我想定义一个函数,我试图设置:
Function Cumulatif(Categorie As String, Debut As Date, Fin As Date) As Double
' Do the sum of a category between a starting and ending date specified
Dim Operations As Variant
Dim SpecificSum As Double
Dim i As Integer
Operations = ThisWorkbook.Sheets("tmp").Range("A1:C3")
For Each Row In Operations.Rows
SpecificSum = 0
Next
Cumulatif = SpecificSum
End Function
但我真的不知道如何从另一张表中获取值并在范围内进行循环以设置此总和。有人可以帮我吗?