任何帮助,将不胜感激。我需要该CountIf
语句来计算所有等于 00:00 的数据点。由于其他公式,该列的格式为 24 小时。00:00 是 if 语句的产物。我已经尝试了很多选项,但除非我将列重新格式化为一般格式,否则它不会计算,但这样做会打乱我需要 24 小时格式的时间格式。谢谢。
Sub Sample()
Dim result As Long, firstrow As Long, lastrow As Long
Dim ws As Worksheet
Dim rng As Range
'~~> Set this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
'~~> Find Lastrow in Col D
lastrow = .Range("V" & .Rows.Count).End(xlUp).Row
'~~> Set First row
firstrow = 16
'~~> Set your range
Set rng = .Range("V" & firstrow & ":V" & lastrow)
'~~> Put relevant values
.Range("U" & lastrow + 3).Value = "No Slip Time"
.Range("V" & lastrow + 3).Value = _
Application.WorksheetFunction.CountIf(rng, "*00:00")
End With
End Sub