Re-setting Forms Spinners or Combo-Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way of re-setting spinners of combo-boxes back to zero easily
with one click instead of having to change each one individually?

I am trying to create a form which requires selecting how many quantities
you want and want to be able to save over the excel document, open it up
re-set everything to zero and re-use it rather than having to save the
document as something else and keeping a master document.

I hope this makes sense, any help would be greatfully received!
 
Just put a reset button on the form and set its on click event to set each
item to zero.
 
Hi Marie

one way to do it would be to set all the default values in the
userform_initilize event then set a button to call it to reset the
form

Private Sub CommandButton1_Click()
UserForm_Initialize
End Sub

Private Sub SpinButton1_SpinDown()
ComboBox1.ListIndex = ComboBox1.ListIndex - 1
End Sub

Private Sub SpinButton1_SpinUp()
ComboBox1.ListIndex = ComboBox1.ListIndex + 1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.List = Array("1", "2", "3", "4", "5", "6", "7")
ComboBox1.ListIndex = 0
SpinButton1.Value = 0
End Sub

hope this helps
 
Hi Marie

You can reset both combo and listboxes by setting their list index to
-1, putting the code below in the code for the reset button or
userform_initialize event (depending on which option you went with
from above) should do the trick

ComboBox1.ListIndex = -1
ListBox1.ListIndex = -1

hope this helps

steve
 
Back
Top