count cells since last non-zero value
Hi Bruce,
Option Explicit
Function cells_after_first_nonzero(r As Range) As Long
Dim rcell As Range
Dim i As Long
i = r.Count
For Each rcell In r
i = i - 1
If rcell.Value < 0 Then
cells_after_first_nonzero = i
Exit Function
End If
Next rcell
cells_after_first_nonzero = i
End Function
Have fun,
Bernd
|