1

我正在尝试为计数提供可变输入,并坚持如何执行以下操作。让我知道是否有任何可能的方法来做到这一点。

 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

但没有一个有效..帮帮我

4

1 回答 1

0

你可以使用这样的东西——我已经为在活动表上查看的样本添加了我自己的值Submit_datelastrow(以及两个日期)A1:A10

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)
于 2013-06-11T06:29:47.607 回答