ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clearing Dropdowns In A Worksheet (https://www.excelbanter.com/excel-programming/280419-clearing-dropdowns-worksheet.html)

Aechelon

Clearing Dropdowns In A Worksheet
 
Hello, what i'm trying to do is this. I have some dropdown boxes from
the forms toolbar, not the control toolbar, in my sheet. I have these
boxes pulling from another sheet that i set up as a database. By using
the index command, i am able to pull various information from the
database sheet depending on the subject selected in the dropdown box.
What I want to do is set up a command button that will reset all the
dropdown boxes back to empty when pressed. I have searched for days
and can not figure this out. Please help!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Aechelon[_2_]

Clearing Dropdowns In A Worksheet
 
Okay, i *FINALLY* got it to work. This is what i did:


Sub Button23_Click()

Dim db As ControlFormat

Set db = ActiveSheet.Shapes("Drop Down 9").ControlFormat

db.ListIndex = 0

End Sub

If there's a better way, i'm always ready to learn. Thanks.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Clearing Dropdowns In A Worksheet
 
Sub Button23_Click()
Dim drpdwn as DropDown
for each drpdwn in Activesheet.Dropdowns
drpdwn.Listindex = 0
Next
End Sub

for a single dropdown.

Sub Button23_Click()
Activesheet.DropDowns("Drop Down 9").ListIndex = 0
End Sub

--
Regards,
Tom Ogilvy

Aechelon wrote in message
...
Okay, i *FINALLY* got it to work. This is what i did:


Sub Button23_Click()

Dim db As ControlFormat

Set db = ActiveSheet.Shapes("Drop Down 9").ControlFormat

db.ListIndex = 0

End Sub

If there's a better way, i'm always ready to learn. Thanks.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:16 AM.

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