Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() make these changes dim (v(4) as integer For i = 1 To 4 v(i) = Cells(row, FirstNumberColumn + i - 1) next i add for i = 2 to 4 if v(i) - v(i-1) = 1 then concsecutive = consecutive + 1 next -- duan ----------------------------------------------------------------------- duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162 View this thread: http://www.excelforum.com/showthread.php?threadid=26587 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy of excel file not showing formulal/function in the function b | Excel Discussion (Misc queries) | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions | |||
Adding a custom function to the default excel function list | Excel Programming | |||
User-Defined Function pre-empting Built-in Function? How to undo???? | Excel Programming |