Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Re-setting Forms Spinners or Combo-Boxes

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Re-setting Forms Spinners or Combo-Boxes

Just put a reset button on the form and set its on click event to set each
item to zero.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Marie" wrote:

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Re-setting Forms Spinners or Combo-Boxes

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Re-setting Forms Spinners or Combo-Boxes

Thanks for this. Do you know if you can re-set combo or list boxes as well?

"Incidental" wrote:

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Re-setting Forms Spinners or Combo-Boxes

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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Re-setting Forms Spinners or Combo-Boxes

Great, thanks!

"Incidental" wrote:

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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Re-setting Forms Spinners or Combo-Boxes

Thanks. This is helpful to me as well.

"Incidental" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
Problems designing combo boxes in forms in Excel 2003 Mikhalis Excel Programming 9 September 11th 07 12:47 PM
User Forms - Combo Boxes Michael Excel Dude Excel Discussion (Misc queries) 2 September 3rd 06 10:41 PM
Excel forms And combo boxes Rob Excel Programming 4 August 24th 05 11:14 AM
Setting Property Values of Text Boxes within Forms SkyEyes Excel Programming 1 July 1st 05 07:06 PM


All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"