比如把符合要求的输出到定义的 z
dim z as long
Dim i As Integer
  For i = 0 To List1.ListCount - 1
        If (InStr(List1.List(i), "ABC") <> 0) Thenz=这里怎么输出???End If
Next i请高手解答 感激不尽

解决方案 »

  1.   

    dim z as long
    Dim i As Integer
      For i = 0 To List1.ListCount - 1
            If (InStr(List1.List(i), "ABC") <> 0) Thenz=z & vbcrlf & List1.List(i)
    End If
    Next i
    Debug.Print z
      

  2.   

    dim z as string 
    Dim i As Integer
      For i = 0 To List1.ListCount - 1
            If (InStr(List1.List(i), "ABC") <> 0) Then
                z=Z & "|" & List1.List(i)
            End If
      Next i
      

  3.   

    dim z as long'你的意思应该是z中保存符合条件的索引所以修改如下
    Dim i As Integer
    For i = 0 To List1.ListCount - 1
        If (InStr(List1.List(i), "ABC") > 0) Then
            'z=这里怎么输出???
            z=i
            Exit For'只要找到1个就结束
        End If
    Next i