View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Michael168[_27_] Michael168[_27_] is offline
external usenet poster
 
Posts: 1
Default How to count in between gap?

merjet wrote:
*Sub macro1()
Dim c As Range
Dim rng As Range
Dim iCt As Integer

Set rng = Sheets("Sheet1").Range("A1:A1000")
For Each c In rng
If c = "Dave" Then
iCt = iCt + 1
If iCt = 1 Then Sheets("Sheet1").Cells(1, 3) = "Dave"
Sheets("Sheet1").Cells(1, 3 + iCt) = c.Row
End If
Next c
End Sub


HTH,
Merjet *


Hello Merjet,
Thanks for the above module.
Is it possible to use input box insteading of definining everything
inside the module itself, so that it will be more friendly user.

I mean if what I want to check against 3 cells within a specific range.
In this case can you modify the routine so that I can type in the input
box for the conditions in 3 cells and the range to search.

Thanks
Michael168



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/