2
votes

i have a ComboBox with 3 items as "Select","Jack" and "Jill". Under Private Sub Workbook_Open() I kept the following lines of code.

With ThisWorkbook.Sheets("Sheet1").ComboBox1
    Items.Clear
    .AddItem "Select"
    .AddItem "Jack"
    .AddItem "Jill"
End With

When ever i select an item and close the excel. Next time if i open the excel by default comboBox showing the previously selected item. But i want to show select as a default item.

1

1 Answers

15
votes

You need to remove Items.Clear should be just .Clear and then use .SelText property to set the selected text

With ThisWorkbook.Sheets("Sheet1").ComboBox1
    .Clear
    .AddItem "Select"
    .AddItem "Jack"
    .AddItem "Jill"
    .SelText = "Select"
End With