xuannguyen13 > 02-07-15, 01:03 PM
Xuân Thanh > 02-07-15, 05:18 PM
Xuân Thanh > 02-07-15, 05:43 PM
Function KetQua(a As Double, b As Double, Loai As Integer) As Double
If IsNumeric(a) = True And IsNumeric(b) = True Then
Select Case Loai
Case Is = 1
KetQua = a + b
Case Is = 2
KetQua = a - b
Case Is = 3
KetQua = a * b
Case Is = 4
If b < 0 Then MsgBox "Khong chia duoc cho so 0": Exit Function
KetQua = a / b
End Select
Else
MsgBox "Khong thuc hien duoc phep tinh khikhong phai la so": Exit Function
End If
End Function
Private Sub CONG_Click()
KQ = KetQua(a, b, 1)
End Sub
tranthanhan1962 > 02-07-15, 06:28 PM
Private Sub CHIA_Click()
If B.Value <> 0 Then
KQ.Value = A.Value / B.Value
Else
Exit Sub
End If
End Sub
Private Sub CHIA_Click()
If B.Value <> 0 Then
KQ.Value = A.Value / B.Value
Else
MsgBox "Số bị chia phải khác 0"
Exit Sub
End If
End Sub
xuannguyen13 > 02-07-15, 10:27 PM