ZNAJDUJE NAJMNIEJSZĄ PARZYSTĄ Z CIĄGU
Dim n, i, x, k, a, t(10), b As Double
Private Sub CommandButton1_Click()
i = 1
k = 0
a = 0
Do Until k = 1
If Cells(i, 1) Mod 2 = 0 Then
x = Cells(i, 1)
k = 1
Else
i = i + 1
If i > n Then
x = "Brak liczb parzystych w zakresie"
k = 1
End If
End If
Loop
For k = i To n
If Cells(k, 1) < x And Cells(k, 1) Mod 2 = 0 Then
x = Cells(k, 1)
a = a + 1
End If
Next k
TextBox2.Text = x
End Sub