1.7.
Private
Sub Numero_Click(num As Integer)
If inicio Then
inicio = False
memoria = Visor
Visor = num
Else
Visor = CCur(Visor * 10 + num)
End If
End
Sub
1.8.
Private
Sub Sinal_Click(s As String)
If Not inicio Then
inicio = True
Select Case sinal
Case "+"
Visor = CCur(memoria + Visor)
Case "-"
Visor = CCur(memoria - Visor)
Case "x"
Visor = CCur(memoria * Visor)
Case "/"
Visor = CCur(memoria / Visor)
End Select
End If
sinal = s
End
Sub
2.6.
Function
CélulasMédia(rng As Range)
Dim celula As Range
Dim soma As Integer
Dim total As Integer
soma = 0
total = 0
For Each celula In rng
soma = soma + celula.Value
total = total + 1
Next
CélulasMédia = soma / total
End
Function
Function
CélulasMáximo(rng As Range)
Dim celula As Range
Dim máximo As Integer
máximo = rng.Cells(1, 1).Value
For Each celula In rng
If celula.Value > máximo Then máximo = celula.Value
Next
CélulasMáximo = máximo
End
Function
Function
CélulasMínimo(rng As Range)
Dim celula As Range
Dim mínimo As Integer
mínimo = rng.Cells(1, 1).Value
For Each celula In rng
If celula.Value < mínimo Then mínimo = celula.Value
Next
CélulasMínimo = mínimo
End
Function
Function
CélulasNãoVazias(rng As Range)
Dim celula As Range
Dim total As Integer
total = 0
For Each celula In rng
If celula.Value <> "" Then total = total + 1
Next
CélulasNãoVazias = total
End
Function