Microsoft KB Archive/161816

= XL97: Min Can Exceed Max on ScrollBar or SpinButton Control =

Article ID: 161816

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q161816



SYMPTOMS
You can set the Min property to a value that is greater than the value for the Max property for the ScrollBar and SpinButton ActiveX controls.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

When you set the Min property to a value that is greater than the value for the Max property, the default behavior of the control is reversed. When this behavior occurs, clicking the arrow that points upward on a SpinButton control decreases the value of the SpinButton instead of increasing the value. The following example illustrates the behavior:

 Close and save any open workbooks, and then create a new workbook. Start the Visual Basic Editor (press ALT+F11). If the Properties Window is not visible, click Properties on the View menu (or press F4). On the Insert menu, click UserForm. Draw a Label control on the UserForm. Draw a SpinButton control on the UserForm. Activate the Properties window (press F4).</li>  Change the following properties for the SpinButton control to the following values: <pre class="fixed_text">      Property      Value ---      Orientation   0 - fmOrientationVertical Min          100 Max          50 Value        75 </li> Double-click the SpinButton to display the Code window for the UserForm.</li>  In the module, type the following code for the SpinButton1 Change event: Private Sub SpinButton1_Change

'Set the Caption of the label to the value of the SpinButton. Label1.Caption = SpinButton1.Value

End Sub </li> Run the UserForm.

When you click the upward pointing arrow on the SpinButton, the value in the label is decreased. This behavior is the result of setting the Min property of the SpinButton to a value that is greater than the value for the Max property.</li> Close the UserForm.</li></ol>

NOTE: This behavior also occurs in a ScrollBar or a SpinButton control is that you place on a worksheet.

<div class="references_section">