且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

禁用选择列表框中的某些项目?

更新时间:2023-11-28 21:55:22

For it = 0 To Sheet1.ListBox1.ListIndex 

  If Sheet1.ListBox1.Selected(it) Then
     Sheet1.ListBox1.Selected(it) = False 
     Sheet1.ListBox1.RemoveItem (it)   
  End If

Next

第1行:遍历列表框的所有索引

Line1 : goes through all the indexes of the listbox

第2行:找到选中的项目

Line2 : find the selected item

第3行:取消选择

第4行:删除所选的项目

Line4 : removes the item selected