Option Explicit
Private Sub cmdLer_Click()
Dim s As Integer, nt As Integer, max As Integer
Dim maxT As Integer, min As Integer, minT
As Integer
Dim med As Single, x As Integer, net As
Integer
nt = Val(txtNT.Text)
If nt < 1 Then
MsgBox "Número de Tarefas
Inválido!"
Exit Sub
End If
max = 0
min = 999
For x = 1
To nt
net = Val(InputBox("Nº de vezes que a tarefa "
& _
x & " foi executada:"))
If net > max Then
maxT = x
max = net
End
If
If
net < min Then
min = net
minT = x
End
If
s = s
+ net
Next
med = s /
nt
txtMed.Text = med
txtTMax.Text
= maxT & " (" & max & " vezes)"
txtTMin.Text = minT & " (" & min & "
vezes)"
If med
<= 3 Then
txtAval.Text = med & " - Excelente Controlo!"
ElseIf
med <= 5 Then
txtAval.Text = med & " - Controlo Mediano!"
Else
txtAval.Text = med & " - O que estava o Eng. Civil lá a fazer?"
End If
End Sub