我正在尝试为countifs提供变量输入,并且坚持如何执行以下操作。 如果有任何可行的方法,请告诉我。
dumi = ".Range(.Cells(2, Submit_date), .Cells(lastrow, Submit_date))"
i = Application.WorksheetFunction.CountIfs(dumi, ">=" & date1, _
dumi, "<=" & date2)
我也试过了,
dumi = .Range(.Cells(2, Submit_date), .Cells(lastrow, Submit_date))
i = Application.WorksheetFunction.CountIfs(dumi, ">=" & date1, _
.Range(.Cells(2, Submit_date), .Cells(lastrow, Submit_date)), "<=" & date2
但没有人工作..帮帮我
答案 0 :(得分:0)
您可以使用类似的内容 - 我在Submit_date
和lastrow
(以及两个日期)中添加了我自己的值,以查找在活动表上查看A1:A10
的示例。< / p>
Dim date1 As Date
Dim date2 As Date
Dim rng1 As Range
Submit_date = 1
lastrow = 10
date1 = #6/2/2013#
date2 = #6/10/2013#
Set rng1 = Range(Cells(2, Submit_date), Cells(lastrow, Submit_date))
MsgBox Application.WorksheetFunction.CountIfs(rng1, ">=" & date1, rng1, "<=" & date2)