Reset Button to reset values to default in Drop List (created in Form Control)

saguilera

New Member
Joined
May 20, 2019
Messages
8
Hi everybody, I got a worksheet in Microsoft excel 365 that contain , let's say 2 drop list. Those drop list were created using developer tab - insert List Box (Form Control). Now, I need to create a "RESET FORM" button that once is clicked, reset the fields of those 2 drop list to first value that are "- Select - ".
I have been trying to assign a few codes to this button ( reading a lot of post in this forum) but none of them seem to works in my case. Also, I noticed that in others posts, answers assign a drop list to a cell, but in my case, mine drop list are like floating in my sheet, and have a range of value... i.e. I found this code:
Sub ResetDataVal()
Sheets("Sheet1").Range("B5").Value = "- Select -"
End Sub

First, one of my drop list is on top of B5 but like I say, is like floating, I can move it to anywhere...
Second, I have assigned values from a range of cells (i.e $N$2:$N15$) and if I change B5 by my range... then when I click on button, all the range cells change to "- Select -"... and I don't want that

What I need: is a RESET button (already created but not working) to my form that reset all my drop list from "number values" choose by user to "- Select -" when they click on RESET button.
In other words, I don't have idea how to do it... please, help !
 
...and use the code like this:
Private Sub CommandButton5_Click()
ActiveSheet.Shapes("DropDown6").ControlFormat.ListIndex = 1
End Sub
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Those are ComboBoxes, not ListBoxes, but the code should still work.
If you have not changed the names of the dropdowns, try
Code:
ActiveSheet.Shapes("Drop Down 6").ControlFormat.ListIndex = 1
Also is the button on the same sheet as the dropdowns?
 
Upvote 0
YESSSSS... Thanks a lot, is working now, also I put the same code changing the name for each dropdowns and everybody reset to the --- Select ---. Thank you so much!!! .... and yes, button is on the same sheet
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
If you have a lot of the dropdowns, you can use something like
Code:
Sub saguilera()
   Dim Ary As Variant
   Dim i As Long
   
   Ary = Array("Drop Down 3", "Drop Down 4", "Drop Down 5")
   For i = 0 To UBound(Ary)
      ActiveSheet.Shapes(Ary(i)).ControlFormat.ListIndex = 1
   Next i
End Sub
 
Upvote 0
Thanks, last variant work as well... I already tried.
Let me ask you this... since I have check boxes, if I like to include all check boxes in this resetting action, code still the same or is different ??
 
Upvote 0
For a checkbox you set the controlformat to False
Code:
   ActiveSheet.Shapes("Check Box 5").ControlFormat = False
 
Upvote 0
Thank you so much!!!!!... everything work perfect right now!!, you have been very helpful !!!!! Thanks a lot
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,793
Members
448,994
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top