选择未注册的案例编号范围



下面有一个简单的case语句,应该在Case -1 To -10的情况下评估-1,并且它跳过了它。我最初认为这个bug是源于Select Case Val(firstOptionLegArray(UBound(firstOptionLegArray))) + Val(secondOptionLegArray(UBound(secondOptionLegArray))),因为它没有达到我的预期(在这个特定的情况下,它应该是+1 + -2)。

运行Debug.Print线,它实际上是评估为-1预期。我错过了什么?

Debug.Print Val(firstOptionLegArray(UBound(firstOptionLegArray))) + Val(secondOptionLegArray(UBound(secondOptionLegArray)))
                Select Case Val(firstOptionLegArray(UBound(firstOptionLegArray))) + Val(secondOptionLegArray(UBound(secondOptionLegArray)))
                    Case 0
                    'No ratio
                        assemblyString = "LIVE " & GetOptionCodes(Mid(tradeLegStructureArray(0), 8, 2)) & " " & TranslateExpirationDate(firstOptionLegArray(3)) & " " & Format(firstOptionLegArray(5), "##0.00") & "/" & _
                        Format(secondOptionLegArray(5), "##0.00") & " Fence"
                    Case -1 To -10
                    'Ratio
                        assemblyString = "LIVE " & GetOptionCodes(Mid(tradeLegStructureArray(0), 8, 2)) & " " & TranslateExpirationDate(firstOptionLegArray(3)) & " " & Format(firstOptionLegArray(5), "##0.00") & "/" & _
                        Format(secondOptionLegArray(5), "##0.00") & " " & Abs(firstOptionLegArray(UBound(firstOptionLegArray))) & "x" & Abs(secondOptionLegArray(UBound(secondOptionLegArray))) & " Fence"
                End Select

line:

Case -10 To -1

最新更新