0
内执行计算我正在执行VB函数以在不同类别的指定期间内对累计金额进行分类。目标是为人事账户开支。VBA Excel在范围内查找日期期间并在
例如,我在表A中的某个日期,B列中的某个类别(例如Salary,Transport ...)和C列中的值中显示了“tmp”。
我要定义一个函数,我已经尝试设置:
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
但我真的不知道如何从另一片得到的值,做循环中设置此金额范围内。有人可以帮助我吗?
这样的函数返回#VALUE错误!我不明白为什么? – user1187727
如果您希望将'Operations'分配为Range对象,那么您需要使用'Set'。如果你的意思是它是一个变种的二维数组(不使用set的话),那么就不会有'.Rows'集合...... –