Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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