Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Count consecutive repeats

Evan: Select the range you're counting before you run the macro.

Sub MyCounter()
OneCounter = 0
For Each c In Selection
If c.Value = 0 Then
c.Offset(0, 1).Value = 0
OneCounter = 0
Else
OneCounter = OneCounter + 1
If c.Offset(1, 0).Value = 0 Then
c.Offset(0, 1) = OneCounter
Else
c.Offset(0, 1) = 0
End If
End If
Next c
End Sub

[Tested OK]

Select the range you're counting before you run the macro.





Reply
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
count number of repeats in a column highlight result bobular Excel Discussion (Misc queries) 1 January 11th 12 02:15 AM
How to use pivot table to count repeats of unique fields Susienak Excel Discussion (Misc queries) 4 August 1st 08 11:15 AM
How can I count the number of repeats in a list of data? SouthCarolina Excel Discussion (Misc queries) 7 March 7th 06 10:03 PM
Count repeats Daniel Bonallack Excel Worksheet Functions 7 December 10th 04 05:13 PM
Count new occurances and not repeats morry[_29_] Excel Programming 1 July 2nd 04 06:52 PM


All times are GMT +1. The time now is 03:47 PM.

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"