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