View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
casey casey is offline
external usenet poster
 
Posts: 3
Default Clear entries on Combo box

I found code below while searching the net. It works, but how do you clear
the entry from the list when workbook is opened. For some reason, the
cboMonth says "August" instead of blank?

Private Sub Workbook_Open()
With Sheet1.cboName
.ListFillRange = ""
.AddItem "John"
.AddItem "Jay"
.AddItem "Mark"
.AddItem "Matt"
.ListIndex = 0
End With
End Sub


Private Sub cboName_Change()
For IndexNbr = cboMonth.ListCount - 1 To 0 Step -1
cboMonth.RemoveItem (IndexNbr)
Next IndexNbr

Select Case cboName.Value

Case "John"
cboMonth.AddItem "Jan"
cboMonth.AddItem "February"
cboMonth.AddItem "March"

Case "Jay"
cboMonth.AddItem "April"
cboMonth.AddItem "May"
cboMonth.AddItem "June"

Case "Mark"
cboMonth.AddItem "July"
cboMonth.AddItem "August"
cboMonth.AddItem "September"

Case "Matt"
cboMonth.AddItem "October"
cboMonth.AddItem "November"
cboMonth.AddItem "December"
Case Else
MsgBox cboName.Value & " Is Not Valid."

End Select
End Sub