View Full Version : Command Button to clear dropdowns


Brando
08-21-2007, 09:50 AM
I want a command button in an Excel form to clear dropdown fields on the form. Can anyone tell me why this simple VB code will not work?:


Private Sub CommandButton2_Click()

DropDown4 = ""
DropDown7 = "Choose from List"

End Sub

unmarkedhelicopter
08-21-2007, 10:53 AM
You have not qualified your objects so Excel does not know what you are talking about.
Assuming you have renamed your combobox to "DropDown4" then you would need to use :-
me.dropdown4.clear and me.dropdown7.clear
me.dropdown7.additem "Choose From List" although this will cause you problems later.