如果不是VBA,我的函数如何输入if语句?

时间:2017-06-09 03:33:46

标签: vba if-statement

我有一个功能,做了一些相当奇怪的事情。尽管if语句没有达到条件,它仍然输入了if语句。这是调试屏幕的图像: enter image description here

请注意,'diameter'是函数ByVal的输入为double,而我输入的值实际上是0.0762。

很可能这是一些愚蠢的我错过了在哪种情况下抱歉,但除此之外我很好奇,并希望听到你的想法。谢谢!

Public Function ErrorMessages(F_T As Double, pressure As Double, ByVal diameter As Double, t As Double, x As Double, xmax As Double, _
   h As Double, error As Double, i As Integer) As Boolean


    diameter = CDec(diameter)           'Because 0.076199999999999999999999999 <> 0.0762...
    ErrorMessages = False

        If diameter <> 0.0762 And diameter <> 0.1524 And diameter <> 0.2032 And diameter <> 0.3048 _
      And diameter <> 0.4064 And diameter <> 0.6096 Then
            MsgBox ("Error: This pipe diameter is not available from the cool pipe guy")
            ErrorMessages = True
        End If


End Function

0 个答案:

没有答案