Re-setting Forms Spinners or Combo-Boxes

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!
 
G

Guest

Just put a reset button on the form and set its on click event to set each
item to zero.
 
I

Incidental

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
 
I

Incidental

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top