How:spinbutton to display negative integers(e.g. range -10 to 10)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a spinbutton and set min and max to -10 and 10 intending yield
a range but clicking down from 0 gives me 65535.00.
 
That's because you can't set the linked cell property <0, you would need
code for this
 
Oops! here's the code, be in design mode and double click on the spinbutton
and use this

Private Sub SpinButton1_Change()
Range("A2").Value = SpinButton1.Value
End Sub

(replace A2 with the cell where you want this)

remove the linked cell in the properties but keep max 10 and min -10


--

Regards,

Peo Sjoblom
 
There is an alternative that does not require code. Just create a
cell link for the spin button that goes from 0 to 20 (assume that
cell is C1). Then create a link to that cell in cell B1 that says
=C1-10. You can hide one or both cells under the spinner button if
you wish.

Now just use cell B1 as cell that you want values to go from -10
to +10. You can do this type transformation for other purposes.
If you need numbers to go from 1% to 20% just divide the link cell by 100.


Pieter Vandenberg

: Oops! here's the code, be in design mode and double click on the spinbutton
: and use this

: Private Sub SpinButton1_Change()
: Range("A2").Value = SpinButton1.Value
: End Sub

: (replace A2 with the cell where you want this)

: remove the linked cell in the properties but keep max 10 and min -10


: --

: Regards,

: Peo Sjoblom




: :> That's because you can't set the linked cell property <0, you would need
:> code for this
:>
:>
:> --
:>
:> Regards,
:>
:> Peo Sjoblom
:>
:> :> > I have created a spinbutton and set min and max to -10 and 10 intending
:> yield
:> > a range but clicking down from 0 gives me 65535.00.
:> >
:>
:>
 
Thanks for your reply and your time.

Peo Sjoblom said:
Oops! here's the code, be in design mode and double click on the spinbutton
and use this

Private Sub SpinButton1_Change()
Range("A2").Value = SpinButton1.Value
End Sub

(replace A2 with the cell where you want this)

remove the linked cell in the properties but keep max 10 and min -10


--

Regards,

Peo Sjoblom
 
Back
Top