ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I create a macro to return drop down boxes to first item i. (https://www.excelbanter.com/excel-discussion-misc-queries/21824-how-do-i-create-macro-return-drop-down-boxes-first-item-i.html)

gaalseth

How do I create a macro to return drop down boxes to first item i.
 
I am using Excel 2000 and have created serveral combo boxes using the forms
menu. I want to create a macro that returns each drop down box to the first
item in the list of choices, or alternatively to an empty state. The combo
boxes all appear on the same sheet and the lists of items and cell references
are all on a different sheet. My familiarity with visual basic is very
limited.

Dave Peterson

Option Explicit
Sub testme()

Dim myDD As DropDown

For Each myDD In ActiveSheet.DropDowns
myDD.ListIndex = 0 ' or 1
Next myDD

End Sub

0 clears the dropdown.
1 choses the first choice.

gaalseth wrote:

I am using Excel 2000 and have created serveral combo boxes using the forms
menu. I want to create a macro that returns each drop down box to the first
item in the list of choices, or alternatively to an empty state. The combo
boxes all appear on the same sheet and the lists of items and cell references
are all on a different sheet. My familiarity with visual basic is very
limited.


--

Dave Peterson


All times are GMT +1. The time now is 08:09 PM.

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