分析我为公司获得的一些数据,我需要对细胞进行计数,因此我可以使用该计数的公式。
CurrentRegion
不起作用。这是需要满足的标准。
计数的细胞必须是:
自动收集此数据,因此未设置填充字符串的字段的坐标。
(set)行如下所示:
Description
Description
...
Time
Time
Time <- This is the data that I want to count.
Time
Time
...
Description
Time
Time
...
如果它只是其中之一,我可能会得到它,但对于我来说相对较新的VBA,这是非常困难的。
我很欣赏每一个提示。 我不希望任何人为我编写代码
答案 0 :(得分:0)
只是为了开始...:
Dim e As Integer
e = 0
For i = 1 To 9999
If Cells(i, 1).Value = "" Then Exit For
If IsNumeric(Cells(i, 1).Value) Then
e = e + 1
' Debug.Print Format(Cells(i, 1).Value, "h:m:s")
Else
If e <> 0 Then Debug.Print "Count = " & e
e = 0
End If
Next
每个部分的宏打印连续时间值的数量
评论打印显示格式化的时间
您需要添加代码才能继续...
如果您还需要行范围,请稍微修改一下代码:
Dim e, i, Addr1 As Integer
e = 0
For i = 1 To 9999
If Cells(i, 1).Value = "" Then Exit For
If IsNumeric(Cells(i, 1).Value) Then
If e = 0 Then Addr1 = i
e = e + 1
' Debug.Print Format(Cells(i, 1).Value, "h:m:s")
Else
If e <> 0 Then Debug.Print "Count = " & e & " - Range of Rows: " & Addr1 & " -> " & i - 1
e = 0
End If
Next