LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default disable entry on listbox

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable cell entry ? H@C0 Excel Programming 4 July 15th 07 02:43 PM
VBA - Disable up down movement inside ListBox -Zoki- Excel Programming 3 November 21st 06 04:08 PM
Disable hyperlinks on entry Barb Reinhardt Excel Discussion (Misc queries) 1 August 23rd 05 02:33 PM
how to disable listbox change event Tom Ogilvy Excel Programming 0 July 27th 04 05:55 PM
Disappearing listbox entry Stuart[_5_] Excel Programming 1 February 26th 04 02:35 PM


All times are GMT +1. The time now is 05:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"