Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I selectively disable an individual entry on a multiselect listbox in a
userform? If so, how? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Smallweed
The code below should sort of do what you want it will check if your item has been clicked and if so it will deselect it. Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If ListBox1.Selected(3) = True Then ListBox1.Selected(3) = False End If End Sub Hope this helps Steve |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about just not including it in the listbox to start--or removing it when it
shouldn't be selected? Or even just ignore it if it is selected? But if you want... Option Explicit Dim BlkProc As Boolean Private Sub CommandButton1_Click() Unload Me End Sub Private Sub CommandButton2_Click() Dim iCtr As Long With Me.ListBox1 For iCtr = 0 To .ListCount - 1 If .Selected(iCtr) = True Then MsgBox iCtr & "--" & .List(iCtr) End If Next iCtr End With End Sub Private Sub ListBox1_Change() Dim ItemToBeAvoided As Long If BlkProc = True Then Exit Sub End If ItemToBeAvoided = 2 'third item (0 based) If Me.ListBox1.Selected(ItemToBeAvoided) = True Then BlkProc = True Me.ListBox1.Selected(ItemToBeAvoided) = False BlkProc = False End If End Sub Private Sub UserForm_Initialize() Dim iCtr As Long With Me.ListBox1 .MultiSelect = fmMultiSelectMulti For iCtr = 1 To 5 .AddItem "A" & iCtr Next iCtr End With End Sub Smallweed wrote: Can I selectively disable an individual entry on a multiselect listbox in a userform? If so, how? Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to disable cell entry ? | Excel Programming | |||
VBA - Disable up down movement inside ListBox | Excel Programming | |||
Disable hyperlinks on entry | Excel Discussion (Misc queries) | |||
how to disable listbox change event | Excel Programming | |||
Disappearing listbox entry | Excel Programming |