J
Jeff
I suppose this is old hat to Excel VBA pro's but it caught me by
surprise. What is there about the default Variant type that makes the
comparison fail (but only for SOME inputs, d1=0.9,d2=0.1,d3=0,d4=0 is
ok!?). Also, uncommenting the dim statement fixes the issue.
Can anyone please explain? (Excel 2000 9.0.4402 SR-1)
Jeff
===
Function foobar()
' Dim d1 As Double, d2 As Double, d3 As Double, d4 As Double, s as
Double
s = 1
d1 = 0.7
d2 = 0.1
d3 = 0.1
d4 = 0.1
If (d1 + d2 + d3 + d4 = s) Then
foobar = False
Else
foobar = True
End If
End Function
surprise. What is there about the default Variant type that makes the
comparison fail (but only for SOME inputs, d1=0.9,d2=0.1,d3=0,d4=0 is
ok!?). Also, uncommenting the dim statement fixes the issue.
Can anyone please explain? (Excel 2000 9.0.4402 SR-1)
Jeff
===
Function foobar()
' Dim d1 As Double, d2 As Double, d3 As Double, d4 As Double, s as
Double
s = 1
d1 = 0.7
d2 = 0.1
d3 = 0.1
d4 = 0.1
If (d1 + d2 + d3 + d4 = s) Then
foobar = False
Else
foobar = True
End If
End Function