vba中ListBox控件的使用


给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等改变内容的输出形式。

 

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM