Hi !
I need some help to finish my little function as below. Even though th
task can be accomplish using the formula but I just want to learn how t
code.
Private Function GetConsecutive(ByVal row&)
Dim i As Integer
Dim v As Integer
Dim Consecutive As Integer
For i = 1 To 4
v = Cells(row, FirstNumberColumn + i - 1)
*** How to add the extra code from below to count the Consecutive?
In plain english;
if 2nd v - 1st = 1 then consecutive = consecutive + 1
if 3rd v - 2nd = 1 then consecutive = consecutive + 1
if 4th v - 3rd = 1 then consecutive = consecutive + 1
else
consecutive=0
endif
Next
Getconsecutive = consecutive
End Function
Thank you for helping.
Regards,
Michae
--
Michael16
-----------------------------------------------------------------------
Michael168's Profile:
http://www.excelforum.com/member.php...info&userid=60
View this thread:
http://www.excelforum.com/showthread.php?threadid=26587