if 条件 then 中的条件必须联在一句话内
怎么让条件复杂些 ,比如说G(1)到G(21)都为0,G(24)=0,G(28)到G(400)都为零时
发生事件
这类语句代码怎么写?求指点,问题解决,立即结分!

解决方案 »

  1.   

    if 
    elseif 
    elseifelse
     end if
      

  2.   

    晕,有几个条件就写几个啊,用And连接
    if 条件1 and 条件2 and 条件3 and 条件4 …… then
      

  3.   

    如果G()是数组的话就好办多了/
    for i=1 to 400
      if g(i)=0 then 
        ....
        发生的事件
        ....
      end if
    next
      

  4.   

    晕倒,这个要用选择select case 语句啊只要三个就行了...
      

  5.   

    Private Sub Command1_Click()
      Dim g(400) As Integer
      If b(g(), 1, 21) And g(24) = 0 And b(g(), 28, 400) Then MsgBox "ok"
    End Sub
    Function b(g() As Integer, s, e) As Boolean
      b = True
      For i = s To e
        If g(i) <> 0 Then
          b = False: Exit Function
        End If
      Next
    End Function