![]() |
Enabling checkboxes in a listbox control
Ahh, I found the answer from another source.
For those who may have the same problem and are wondering, it's found in the ".Selected" property. Dim A As Boolean, Z(9) As String, I As Integer With Userform1.Listbox1 For I = 0 To 9 .AddItem Z(I) .Selected(I) = A End If Next I End With Ok, it was probably easy for the guru's but I'm dumb. Tok -----Original Message----- I know to enable a checkbox for a listbox with a plain liststyle would be something like: Userform1.Listbox1.Text = "Listitem1" How does one do this for an option liststyle? I'm looking to be able to multi-select several items in a listbox with the listbox liststyle set as an "option" list style with multiselect property set as "multi". Here's the code I have: Dim A As Boolean With Userform1.Listbox1 For I = 1 To 10 .AddItem Z(I) If A Then ' Code here to checkbox if A is true. End If Next I End With Putting in the line "Userform1.Listbox1.Text = Z(I)" only work for plain liststyles and only if you want one box checked. It fails when the listbox is setup for an "option" liststyle with multiselect as "multi". Is it doable this way or am I just smoking something really good? Any advice appreciated! Thanks, Tok . |
All times are GMT +1. The time now is 05:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com