Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SpinuButtons (Excel 2000)

    Forgive this simple question but how to I get a spinbutton value to display in decimal format?

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinuButtons (Excel 2000)

    You can't. It will only work with integer values.

    However, you may be able to simulate a decimal value depending on where you are using the SpinButton.

    Are you using it on a Worksheet or on a UserForm?
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SpinuButtons (Excel 2000)

    You can't - not directly. A spin button always has an integer value.
    Say that you want to display values 0, 0.05, 0.10, ... up to 1. Set the Min value of the spin button to 0, the Max to 20, and the SmallChange to 1.
    The linked cell - let's assume it is A1 - will display values 1, 2, ..., 20. In another cell, say B1, enter the formula =A1/20. This cell will display 0, 0.05, 0.1 etc. (you can set the number format to display a fixed number of decimals if you prefer).
    You might hide the linked cell now.

  4. #4
    Lounger
    Join Date
    Mar 2003
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinuButtons (Excel 2000)

    I was trying it on a UserForm. I assumed it was possible it VBA as dialogs in native Word/Excel have spin buttons in decimals.

  5. #5
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinuButtons (Excel 2000)

    To simulate a decimal, in the change event of the Spin button put:

    TextBox1.Text = SpinButton1.Value /10 ' to get one decimal point

    Then when you need to use the value, use the value from the text box and not the value from the SpinButton.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  6. #6
    Lounger
    Join Date
    Mar 2003
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinuButtons (Excel 2000)

    Thanks very much this works great. When your starting out you always look for a difficult answer and not what is simple.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •