|
本帖最后由 lingyuncelia1 于 2016-4-23 21:36 编辑
Sub celia()
For i = 1 To 2
If TimeValue("6:0:0") < Cells(i, 1) < TimeValue("7:0:0") Then
MsgBox "ok"
End If
mycount = Application.WorksheetFunction.CountIf(Columns("a:a"), TimeValue("6:0:0") < Cells(i, 1) < TimeValue("7:0:0"))
If mycount >= 1 Then MsgBox "pass"
Next
End Sub
为什么红体字代码运行无效?
Sub celia()
For i = 1 To 2
If TimeValue("6:0:0") < Cells(i, 1) and cells(i,1)< TimeValue("7:0:0") Then
MsgBox "ok"
End If
mycount = Application.WorksheetFunction.CountIfs(Columns("a:a"), ">"&TimeValue("6:0:0"),Columns("a:a"), "<" & TimeValue("7:0:0"))
If mycount >= 1 Then MsgBox "pass"
Next
End Sub
|
|