我是VBA的新手。我正在尝试在VBA中完成以下内容,并且不确定如何执行此操作。
我想要做的是,当脚本运行时,它应首先抛出一个对话框,要求用户输入日期范围。一旦用户给出日期范围,它应该选择那些列并在“o”列中查找“Pass”并计算该值并在特定单元格中更新它。
我尝试过以下代码,但我不确定如何使用日期范围标准添加计数值:
Sub WBR()
Dim s As String
Dim r As Range
Dim wf As WorksheetFunction
Dim xlSheet As Worksheet
Set xlSheet = ActiveWorkbook.Worksheets("Latency") 'sets the worksheet
Set wf = Application.WorksheetFunction
Set r = xlSheet.Range("O:O") 'sets the range to search
s = "Pass"
[AE4] = wf.CountIf(r, s)
s = "Fail"
[AE5] = wf.CountIf(r, s)
With ActiveWorkbook.Worksheets("TT")
[AE119] = wf.CountIfs(.Range("G:G"), "Yes", _
.Range("K:K"), "Tablet")
End With
With ActiveWorkbook.Worksheets("TT") 'no of tickets processed
[AE119] = wf.CountIfs(.Range("G:G"), "Yes", _
.Range("I:I"), "<>Duplicate TT", _
.Range("K:K"), "Tablet")
End With
End Sub
答案 0 :(得分:0)
这只是您现有代码的一个小变化:
ClassifierCompositeItemWriter