+ Reply to Thread
Results 1 to 4 of 4

spin button code

  1. #1
    jhahes
    Guest

    spin button code

    How do I get the spin button to control the text box

    I want TextNumberOfGames(TextBox) to change when the SpinNumberOfGames(SpinButton) is clicked up or down.

    This is all in a form. I have already set the min, max, and change.

    I would also like, if possible for the default to be 1, when the form opens.


    Thanks

    Josh

  2. #2
    JakeyC
    Guest

    Re: spin button code

    One way of doing it would be the following code (you'll have to insert
    your limits)...

    Option Explicit
    Public i As Integer

    Private Sub SpinNumberOfGames_SpinDown()
    i = i - 1
    TextNumberOfGames.Value = i

    End Sub

    Private Sub SpinNumberOfGames_SpinUp()
    i = i + 1
    TextNumberOfGames.Value = i

    End Sub

    Private Sub UserForm_Activate()
    i = 1
    TextNumberOfGames.Value = i

    End Sub


  3. #3
    Tom Ogilvy
    Guest

    Re: spin button code

    In the change event of the spin button, update the textbox with the value of
    the spin button

    In the initialize event of the userform, change the value of the spinbutton
    to 1.

    --
    Regards,
    Tom Ogilvy


    "jhahes" <[email protected]> wrote in
    message news:[email protected]...
    >
    > How do I get the spin button to control the text box
    >
    > I want TextNumberOfGames(TextBox) to change when the
    > SpinNumberOfGames(SpinButton) is clicked up or down.
    >
    > This is all in a form. I have already set the min, max, and change.
    >
    > I would also like, if possible for the default to be 1, when the form
    > opens.
    >
    >
    > Thanks
    >
    > Josh
    >
    >
    > --
    > jhahes
    > ------------------------------------------------------------------------
    > jhahes's Profile:

    http://www.excelforum.com/member.php...o&userid=23596
    > View this thread: http://www.excelforum.com/showthread...hreadid=475931
    >




  4. #4
    JakeyC
    Guest

    Re: spin button code

    ....and I never knew a SpinButton held its own value. Makes sense
    really...


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1