Go into design mode again.
Click on the Properties icon on that control toolbox toolbar
select a combobox
look for Style
You'll see a couple of options.
fmStyleDropDownCombo
and
fmStyleDropDownList
The "fmStyleDropDownCombo" allows users to type anything into the combobox.
the "fmStyleDropDownList" allows typing--but it has to match.
So you can add one line in your code (at the bottom):
'.....
With obj
.Left = rng.Left
.Top = rng.Top
.Width = rng.Width
.Height = rng.Height
.Object.AddItem "text1"
.Object.AddItem "text2"
.Object.AddItem "text3"
.Object.Style = fmStyleDropDownList '<-----
If IsNumeric(Target.Value) Then
If CLng(Target.Value) < .Object.ListCount _
And CLng(Target.Value) 0 Then
.Object.Value = .Object.List(CLng(Target.Value) - 1)
End If
End If
End With
Application.ScreenUpdating = True
End If
End Sub
Paul wrote:
Amazing!!! This works like a charm as well. Thank you so much once
again.
Could you tell me how (in de code) you can adjust the combobox so that
users cannot edit its contents but can still choose one of three
options?
Paul
--
Dave Peterson