Private Sub Command1_Click()
 rn = Val(Text1.Text)
 ri = Val(Text2.Text)
 Select Case rn
   
   Case Is >= 0, Is <= 25    Select Case ri
           
   Case Is <= 50
   
   Text3.Text = "一级"
   
     Case Is > 50, Is <= 100
   
   Text3.Text = "二级"
     Case Is > 100
   Text3.Text = "三级"
   
   End Select
    Case Is > 25, Is <= 50    Select Case ri
     Case Is <= 25
   
   Text3.Text = "一级"
   
   Case Is > 25, Is <= 50
   
   Text3.Text = "二级"
     Case Is > 50, Is <= 100
   
   Text3.Text = "三级"
     Case Is > 100
   Text3.Text = "四级"
   
   End Select
        Case Is > 50, Is <= 100    Select Case ri
     Case Is <= 10
   
   Text3.Text = "一级"
   Case Is > 10, Is <= 25
   Text3.Text = "二级"
   
   Case Is > 25, Is <= 50
   
   Text3.Text = "三级"
     Case Is > 50, Is <= 100
   
   Text3.Text = "四级"
     Case Is > 100
   Text3.Text = "四级"
   
   End Select
       Case Is > 100, Is <= 200    Select Case ri
     Case Is <= 10
   
   Text3.Text = "二级"
   Case Is > 10, Is <= 25
   Text3.Text = "三级"
   
   Case Is > 25, Is <= 50
   
   Text3.Text = "四级"
     Case Is > 50, Is <= 100
   
   Text3.Text = "四级"
     Case Is > 100
   Text3.Text = "五级"
   
   End Select
      Case Is > 200, Is <= 300    Select Case ri
     Case Is <= 10
   
   Text3.Text = "三级"
   Case Is > 10, Is <= 25
   Text3.Text = "四级"
   
   Case Is > 25, Is <= 50
   
   Text3.Text = "四级"
     Case Is > 50, Is <= 100
   
   Text3.Text = "五级"
     Case Is > 100
   Text3.Text = "五级"
   
   End Select
      Case Is > 300    Select Case ri
     Case Is <= 10
   
   Text3.Text = "四级"
   Case Is > 10, Is <= 25
   Text3.Text = "四级"
   
   Case Is > 25, Is <= 50
   
   Text3.Text = "五级"
     Case Is > 50, Is <= 100
   
   Text3.Text = "五级"
     Case Is > 100
   Text3.Text = "五级"
   
   End Select
   End Select
  不知道哪出问题了,怎么很多数值没办法计算的感觉,卡在某个数值

解决方案 »

  1.   

    我给你整理了一下,你自己看看
    Private Sub Command1_Click()
         rn = Val(Text1.Text)
         ri = Val(Text2.Text)
         Select Case rn
            Case Is >= 0, Is <= 25
                Select Case ri
                    Case Is <= 50
                        Text3.Text = "一级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "二级"
                    Case Is > 100
                        Text3.Text = "三级"
                End Select
            Case Is > 25, Is <= 50
                Select Case ri
                    Case Is <= 25
                        Text3.Text = "一级"
                    Case Is > 25, Is <= 50
                        Text3.Text = "二级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "三级"
                    Case Is > 100
                        Text3.Text = "四级"
                End Select
            Case Is > 50, Is <= 100
                Select Case ri
                    Case Is <= 10
                        Text3.Text = "一级"
                    Case Is > 10, Is <= 25
                        Text3.Text = "二级"
                    Case Is > 25, Is <= 50
                        Text3.Text = "三级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "四级"
                    Case Is > 100
                        Text3.Text = "四级"
                End Select
            Case Is > 100, Is <= 200
                Select Case ri
                    Case Is <= 10
                        Text3.Text = "二级"
                    Case Is > 10, Is <= 25
                        Text3.Text = "三级"
                    Case Is > 25, Is <= 50
                        Text3.Text = "四级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "四级"
                    Case Is > 100
                        Text3.Text = "五级"
                End Select
            Case Is > 200, Is <= 300
                Select Case ri
                    Case Is <= 10
                        Text3.Text = "三级"
                    Case Is > 10, Is <= 25
                        Text3.Text = "四级"
                    Case Is > 25, Is <= 50
                        Text3.Text = "四级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "五级"
                    Case Is > 100
                        Text3.Text = "五级"
                End Select
            Case Is > 300
                Select Case ri
                    Case Is <= 10
                        Text3.Text = "四级"
                    Case Is > 10, Is <= 25
                        Text3.Text = "四级"
                    Case Is > 25, Is <= 50
                        Text3.Text = "五级"
                    Case Is > 50, Is <= 100
                        Text3.Text = "五级"
                    Case Is > 100
                        Text3.Text = "五级"
                End Select
        End Select
    End Sub
      

  2.   

    感谢楼上的整理,不过还是没效果,不知道什么原因,只能计算出初级0-20之间的结果,一级或者二级,
    rn ri数值无论如何变大,都停留在二级位置
      

  3.   

    取范围要用to...    Select Case rn
            Case 0 to 25
                '.......
            Case 25 to 50
                '......
            Case 50 to 100
                '......
            Case 100 to 200
                '......
            Case 200 to 300
                '......
            Case 300
                '......
        End Select
    End Sub
      

  4.   


    Case Is >= 0, Is <= 25 是或的关系,只要满足其中之一。你所有的值都大于等于 0, 所以一定走此路径。你可以将 Case 倒过来:Case Is > 300Case Is > 200Case Is > 100Case Is > 50Case Is > 25Case Else 
      

  5.   

         Select Case rn
            Case Is >= 0, Is <= 25
    ***********************************
    你所写的逻辑是错误的
    假如 rn=60
    会符合Is >= 0这个条件,这里就可以判断通过