Setting default value for combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm populating the values for a combo box using the following:

With Me.cboPlanMonth
.AddItem cMonth.Value
.List(.ListCount - 1, 1) = cMonth.Offset(0, 1).Value
End With

I have saved a value of the planned month as PlanMonth and would like for
the combo box to default to that value when it's opened. What do I need to
do to get this to work?

Thanks
 
With Me.cboPlanMonth
.AddItem cMonth.Value
If cMonth.Value = PlanMonth Then
.ListIndex = .ListCount -1
End If
.List(.ListCount - 1, 1) = cMonth.Offset(0, 1).Value
End With


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top