給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等改變內容的輸出形式。
