LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting strings of consecutive numbers in a column SamG Excel Discussion (Misc queries) 1 January 27th 10 07:25 AM
counting consecutive absences jerry37917 Excel Worksheet Functions 6 October 9th 07 09:22 PM
Counting Consecutive Instances carl Excel Worksheet Functions 3 September 24th 07 07:08 PM
Counting the largest number of consecutive 1's in a column DavidS New Users to Excel 3 November 17th 06 11:19 AM
counting consecutive repeated values in a column along with the range g s[_3_] Excel Programming 1 September 22nd 05 08:51 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"