View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David Coleman David Coleman is offline
external usenet poster
 
Posts: 28
Default Disable item in combobox

Hi Peter

Out of interest, why do you want to do this? I don't know of a way of doing
this exactly but you could check the chosen value and reject it if it's the
wrong one.

For example, assume combobox1 has three values "Tom", "Dick", "Harry" and
that you don't want the user to be able to choose "Dick"

Private Sub ComboBox1_Change()
If (ComboBox1.Value = "Dick") Then
MsgBox ("Dick is not a valid selection")
ComboBox1.ListIndex = -1
End If
End Sub

This way the user can choose any value (including Dick) buts gets shown a
message when Dick's chosen saying "not valid" and the listindex is set to -1
(i.e. no item chosen)

Hope this helps

David



"Peter Pantus" wrote in message
l...
Hi,

Is it possible in a combox to disable one item so the user see the item

but
does not can select the item??

Thanks