Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone:
In excel VBA, I have the following code: Public Function MY_tester(z, w) On Error GoTo ErrHandler If Not IsNumeric(z) Then MY_tester = "Error: Z must be a number" ElseIf Not IsNumeric(w) Then MY_tester = "Error: w must be a number" ElseIf ((z + w) < 0) And ((z + w) = Fix(z + w)) Then MY_tester = "Error: z+w cannot be zero nor negative integers" Else MY_tester = "Answer OK" End If ErrHandler: If Err Then MY_tester = "Error: " & Err.Description End If End Function Public Sub MY_SUB() MsgBox MY_tester(-4.4, 3.4) End Sub When I run the sub MY_SUB, the program returns false for ((z + w) = Fix(z + w)) , even though it is true (after all, -1 is equal to -1). Does anyone know why? I think this may be a bug in VBA. I appreciate all your help. Bob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Large Operation Error | Excel Discussion (Misc queries) | |||
Error 1004 on VBA operation | Excel Programming | |||
can excel produce text in a given cell as a result of a boolean operation? | Excel Discussion (Misc queries) | |||
why do I get a illegal operation error? | New Users to Excel |