June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
14
Task/Detect-division-by-zero/VBA/detect-division-by-zero.vba
Normal file
14
Task/Detect-division-by-zero/VBA/detect-division-by-zero.vba
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Option Explicit
|
||||
|
||||
Sub Main()
|
||||
Dim Div
|
||||
If CatchDivideByZero(152, 0, Div) Then Debug.Print Div Else Debug.Print "Error"
|
||||
If CatchDivideByZero(152, 10, Div) Then Debug.Print Div Else Debug.Print "Error"
|
||||
End Sub
|
||||
|
||||
Function CatchDivideByZero(Num, Den, Div) As Boolean
|
||||
On Error Resume Next
|
||||
Div = Num / Den
|
||||
If Err = 0 Then CatchDivideByZero = True
|
||||
On Error GoTo 0
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue