Count latest number of continous not-empty cells in a row.
correction just in case there is no empty cell
Function MyCount(rng As Range)
Dim i As Integer
Dim lastCol As Integer
lastCol = Cells(rng.Row, rng.Columns.Count).End(xlToLeft).Column
i = lastCol
While Not IsEmpty(Cells(rng.Row, i))
i = i - 1
If i = 0 Then MyCount = 0: Exit Function
Wend
MyCount = Application.CountA(Range(Cells(rng.Row, i), Cells(rng.Row, lastCol)))
End Function
isabelle
|