在VBA中比较负数的问题

时间:2019-09-18 06:11:30

标签: excel vba

我还是VBA的新手,我敢肯定这是一个简单的问题,但是我正在比较负数,例如,如果我将textboxMIN输入到-7,将textboxMAX输入到-1,则较小的数字-1将小于-7。我不知道该怎么解决,因为对我来说条件是正确的,但结果却不正确。请查看我的代码是否有问题

   '/************PROCESS***************/
    For t_int_iteratorI = 0 To txt_NumOperands.Value - 1
        MultiPage1.Pages.Add
        MultiPage1.Pages(t_int_iteratorI).Caption = "Variable" & t_int_iteratorI + 1

        Call sub_LabelPerPage
      Set p_var_SetTxtBox = frm_RangeForm.MultiPage1.Pages(t_int_iteratorI).Controls.Add("Forms.TextBox.1", "MinBox")
        With p_var_SetTxtBox
            .Top = 50
            .Left = 100
        End With

     Set p_var_SetTxtBox = frm_RangeForm.MultiPage1.Pages(t_int_iteratorI).Controls.Add("Forms.TextBox.1", "MaxBox")
        With p_var_SetTxtBox
            .Top = 50
            .Left = 300
        End With
    Next t_int_iteratorI     

               p_var_MaxValue = frm_RangeForm.MultiPage1.Pages(t_int_iteratorI).maxbox.Value
               p_var_MinValue = frm_RangeForm.MultiPage1.Pages(t_int_iteratorI).MinBox.Value

                 If p_var_MinValue > p_var_MaxValue Then
                   MsgBox "MIN value should be lesser than MAX value."
                   Exit Sub
                 End If

提前谢谢!

0 个答案:

没有答案