Version 1:
Use this if the 9000 or so rows don't have blanks in them.
In this version you just need to select the first cell and run the
macro. (so in your example case you will be selecting A5)
Code:
--------------------
Dim i, r, c, min, count, range As Integer
r = Selection.Row
c = Selection.Column
range = 10 'the number of rows to look at one time
While Len(Cells(r, c).Text) > 0
i = 0
count = 0
min = Cells(r, c).Value
For i = 0 To (range - 1)
If Cells(r + i, c).Value < min Then
min = Cells(r + i, c).Value
If min < Cells(r + i + 1, c).Value Then
count = count + 1
End If
End If
r = r + 1
Next i
MsgBox count
Wend
--------------------
If they do have blanks then you can use version 2 but you will need to
know how many rows you have in total:
Version 2:
Code:
--------------------
Dim j, i, r, c, end, min, count, range As Integer
r = Selection.Row
c = Selection.Column
range = 10 'the number of rows to look at one time
end = 9000 ' the number of rows you want to look at in total
For j = 1 to end
i = 0
count = 0
min = Cells(r, c).Value
For i = 0 To (range - 1)
If Cells(r + i, c).Value < min Then
min = Cells(r + i, c).Value
If min < Cells(r + i + 1, c).Value Then
count = count + 1
End If
End If
r = r + 1
Next i
MsgBox count
Next j
--------------------
--
schoujar
------------------------------------------------------------------------
schoujar's Profile:
http://www.excelforum.com/member.php...o&userid=26574
View this thread:
http://www.excelforum.com/showthread...hreadid=547315