
Option Explicit
Sub minimo()
Dim a As Range, b As Range, c As Range
Dim myval As Double
Set a = Range("B1:C20")
Set b = Range("E1:F20")
myval = Cells(1, 2)
For Each c In a
If c.Value >= 1 And myval > c.Value Then
myval = c.Value
End If
Next c
For Each c In b
If c.Value >= 1 And myval > c.Value Then
myval = c.Value
End If
Next c
MsgBox myval
End Sub |
D21=PICCOLO(B2:F20;CONTA.SE(B2:C20;"<=0")+CONTA.SE(E2:F20;"<=0")+1) |
D21=MIN(PICCOLO(B1:C20;CONTA.SE(B1:C20;"<=0")+1);PICCOLO(E1:F20;CONTA.SE(E1:F20;"<=0")+1)) |
Option Explicit
Sub minimo()
Dim a As Range, cell As Range, myvalue As Long
Set a = Union(Range("B1:C20"), Range("E1:F20"))
myvalue = 1000000000#
For Each cell In a
If cell < myvalue And Val(cell) > 0 Then myvalue = cell
Next
MsgBox myvalue
End Sub |
