给ListBox添加内容

If CheckBox8 = True Then—————————checkbox控件被选中

    For i = 0 To ListBox1.ListCount – 1————–循环将值赋到ListBox中
        If i < ListBox1.ListCount Then
    \’        If ListBox1.Selected(i) Then
    \’            ListBox1.RemoveItem (i) —————clear   selected row 删除选中内容
                Me.ListBox1.Selected(i) = True———-Me只有在同一个页面的时候才用  sheet5.ListBox1.Selected(i) = True 适用所有情况。
    \’            i = i – 1
    \’        End If
        End If
    Next

Else
    For i = 0 To ListBox1.ListCount – 1
        If i < ListBox1.ListCount Then
   
                Me.ListBox1.Selected(i) = False
   
        End If
    Next
   
End If

 

通过调节ListBox属性调节ListBox多选或者单选ListSytle等改变内容的输出形式。

 

 

 

 

 

版权声明:本文为zigewb原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/zigewb/p/3414519.html