Microsoft KB Archive/213303

= XL2000: How to a Make Spinner with a Minimum Value Less Than Zero =

Article ID: 213303

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213303





SUMMARY
In Microsoft Excel, the spinner control that is on the Forms toolbar has a minimum value of zero.

The Microsoft Excel Visual Basic for Applications macro example in this article demonstrates how you can use a spinner control that appears to allow negative numbers.



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

In the following example, you create a spinner control that appears to have a minimum value of -10 and a maximum value of 10. The spinner control stores its result in cell A1.  Start Excel, and then create a new workbook. On the View menu, point to Toolbars, and then click to select the Forms check box (if it is not already checked). On the Forms toolbar, click the Spinner control. Click Cell A1 to place the spinner control next to cell A1 on your worksheet. Double-click the spinner control to display the Format Control dialog box. On the Control tab, type 0 in the Minimum value box, type 20 in the Maximum value box, and then click OK.

NOTE: You set the Maximum to 20 because the difference between the minimum and the maximum values that you want to use is 20 (that is, 10-(-10)=20).</li> Right-click the spinner control, and then click Assign Macro on the shortcut menu.</li> In the Assign Macro dialog box, click New.</li>  Type the following code in the module sheet: Const Diff = 10 Sub Spinner1_Change Range("A1").Value = ActiveSheet.Spinners("Spinner 1").Value - Diff End Sub NOTE: The constant Diff is equal to the difference between 0 and the minimum value that you want to use (that is, 0-(-10) = 10). </li> Press ALT+F11 to return to Excel.</li> Select cell A1.</li> Test the spinner control by clicking it. You see values in cell A1 that range between -10 and 10.</li></ol>

Keywords: kbdtacode kbhowto kbprogramming KB213303

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.