我在下面有一个简单的case语句,它应该在Case -1 To -10
的情况下评估-1并且它正在跳过它。我最初认为这个错误来自于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
答案 0 :(得分:3)
值line
:
Case -10 To -1