Count between Values
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim iStart As Long
iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
iStart = 1
For i = 2 To iLastRow
If Cells(i, "B").Value < 0 Then
Cells(i, "C").Value = i - iStart + 1
iStart = i + 1
i = i + 1
End If
Next i
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"smandula" wrote in message
...
I would you count zero values between real values inclusive?
Hopefully in VBA
Such as:
A B C
1 2
2 0
3 0
4 1 count 4
5 1
6 0
7 1 count 3
8 1
9 1 count 2
10 8
11 0
12 2 count 3
With Thanks
Steve
|