View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Jeremy Jeremy is offline
external usenet poster
 
Posts: 184
Default Visual Script to find smallest number greater than 0

Does this go under a Sub Macro?

Thanks

"Mike H" wrote:

Hi,

Here's a brute force way

Sub ChangelinkT()
Dim MyMin As Long, LastRow As Long
Dim MyRange As Range
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow)
MyMin = WorksheetFunction.Max(MyRange)
For Each c In MyRange
If c.Value 0 And c.Value < MyMin Then
TheMin = c.Address
MyMin = c.Value
End If
Next
Range(TheMin).Select
End Sub

Mike

"Jeremy" wrote:

I am looking for a script to find the smallest number greater than 0 in a
column and select it.

Thank you