ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Drop Down box (https://www.excelbanter.com/excel-discussion-misc-queries/45930-drop-down-box.html)

GWB Direct

Drop Down box
 
I have a drop down box with the first cell in the list I left blank. I woulod
like to set up a button that would reset the drop down button to a blank.
What would the code be.
Thank You
--
Gary Baker

Dave Peterson

It would depend on what you used to create that dropdown--and where you'd place
that code would depend on the type of button you used.

If you used Data|validation, then...
worksheets("sheet1").range("a1").clearcontents
or
worksheets("sheet1").range("a1").value = ""

If you used a dropdown from the Forms toolbar, then...
Worksheets("sheet1").DropDowns("drop down 1").Value = 0
or
Worksheets("sheet1").DropDowns("drop down 1").ListIndex = 0

If you used a combobox from the control toolbox toolbar, then...
Worksheets("sheet1").ComboBox1.Value = ""
or
Worksheets("sheet1").ComboBox1.ListIndex = -1


GWB Direct wrote:

I have a drop down box with the first cell in the list I left blank. I woulod
like to set up a button that would reset the drop down button to a blank.
What would the code be.
Thank You
--
Gary Baker


--

Dave Peterson

GWB Direct

Thanks Dave. As always you have been a big help. I used the forms toobar to
create the button and the combo drop down box. I'll try to use your code.
--
Gary Baker


"Dave Peterson" wrote:

It would depend on what you used to create that dropdown--and where you'd place
that code would depend on the type of button you used.

If you used Data|validation, then...
worksheets("sheet1").range("a1").clearcontents
or
worksheets("sheet1").range("a1").value = ""

If you used a dropdown from the Forms toolbar, then...
Worksheets("sheet1").DropDowns("drop down 1").Value = 0
or
Worksheets("sheet1").DropDowns("drop down 1").ListIndex = 0

If you used a combobox from the control toolbox toolbar, then...
Worksheets("sheet1").ComboBox1.Value = ""
or
Worksheets("sheet1").ComboBox1.ListIndex = -1


GWB Direct wrote:

I have a drop down box with the first cell in the list I left blank. I woulod
like to set up a button that would reset the drop down button to a blank.
What would the code be.
Thank You
--
Gary Baker


--

Dave Peterson



All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com