View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default Returning the row no of the lowest non-zero cell in a range

Sub MinRow()
Dim rng As Range
Dim MyRow As Long
Dim MyFormula As String

Set rng = Sheet1.Range("B10:B25")
MyFormula = WorksheetFunction.Match(WorksheetFunction.Small _
(rng, WorksheetFunction.CountIf(rng, 0) + 1), rng, 0)
MyRow = MyFormula + 9
End Sub

Mike F
"Peter Rooney" wrote in message
...
Good morning all,

Can anyone suggest a quick way of returning the row number of the lowest
cell in a range (e.g. B10:B25) that contains a non-zero value? I thought
of a
nested loop where the value of each cell is tested and the row number
stored
is to a varable if it is greater than the value already stored there, but
this needs to be part of a worksheet_change macro and it might slow things
down too much doing things in this way.

Thanks in advance

Pete