For-Next by a row Counting consecutive Zero in the column
On Wednesday, April 24, 2013 1:40:28 PM UTC-7, Claus Busch wrote:
Hi Howard,
Am Wed, 24 Apr 2013 13:33:12 -0700 (PDT) schrieb Howard:
I used the ['If count or rows differs from column to column] and works fine with one small exception:
10
0
0
0
0
x
With a column like this, cell 20 should = 0 (because the first cell is not a zero the column is then dismissed)
sorry, I forgot.
You have to insert a Else:
For Each rngC In Range("R26:AK26")
If rngC = 0 Then
Cells(20, rngC.Column) = 1
LRow = Cells(Rows.Count, rngC.Column).End(xlUp).Row
For i = 27 To LRow
If Cells(i, rngC.Column) = 0 Then
Cells(20, rngC.Column) = _
Cells(20, rngC.Column) + 1
Else
Exit For
End If
Next i
Else
Cells(20, rngC.Column) = 0
End If
Next rngC
Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Wonderful, perfect again!
Thanks Claus, as always I sure appreciate you good work.
Howard
|