```
Sub GreatestSum()
[COLOR=#00ff00]'http://www.mrexcel.com/forum/excel-questions/981379-find-if.html[/COLOR]
Dim i As Integer
Dim x As Long
Dim startcell As Integer
[COLOR=#00ff00]'dim greatest as Long in case decimals are used[/COLOR]
Dim greatest As Long
Dim GreatPos As Integer
[COLOR=#00ff00]'for each row starting with 1 until the last one with a value[/COLOR]
For i = 1 To ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
[COLOR=#00ff00] 'check to see if you are starting an new sequence at zero[/COLOR]
If Cells(i, 1) = 0 Then
[COLOR=#00ff00] 'if the last sequence was greater than the greatest sequence so far[/COLOR]
If x > greatest Then
[COLOR=#00ff00] 'set the sum to the greatest[/COLOR]
greatest = x
[COLOR=#00ff00] 'mark the position of the zero that started it.[/COLOR]
GreatPos = startcell
End If
[COLOR=#00ff00] 'mark the postion of the latest zero[/COLOR]
startcell = i
[COLOR=#00ff00] 'reset the sum to zero[/COLOR]
x = 0
End If
[COLOR=#00ff00] 'start summing this sequence[/COLOR]
x = x + Cells(i, 1)
Next
[COLOR=#00ff00]'reset the counter[/COLOR]
i = 1
[COLOR=#00ff00]'loop thru the greatest sequence[/COLOR]
Do
[COLOR=#00ff00] 'B column = A column, starting at the zero position[/COLOR]
Cells(GreatPos + i, 2) = Cells(GreatPos + i, 1)
'next row
i = i + 1
[COLOR=#00ff00]'stop looping when you hit the next zero[/COLOR]
Loop Until Cells(GreatPos + i, 1) = 0
End Sub
```