+ Reply to Thread
Results 1 to 9 of 9

Help with Spin Button. Set Spin button starting value based on a text box value

  1. #1
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Arrow Help with Spin Button. Set Spin button starting value based on a text box value

    I cant really figure out how to manipulate this spin button

    I have a simple userform with a textbox and spin butto
    The textbox displays the value that is found in column a in sheet 1

    say there are 10 rows
    row 1 value is "a"
    row 2 value is "b" down to row value 10 is "j"

    what I wan to achieve is to use the spin button where the and down button will display the next or previous cell value thats is displayed in the textbox.

    for example if I write "f' in the textbox when I hit the up button it should display "g" or it will display "e" if I hit thr down button.

    what Ive been doing is that when I put a value let us say c when i press the up or down button it will go back to a not yo d or b respectively. thank you in advance.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,023

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    If you attach your file I will modify it to show you how to do this. There is more than one way to do this and the best way depends on what you have done so far.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    I dont have a file yet. can you give me a idea on how can it be done? thank you

  4. #4
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    Here is the file
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    anyone please?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,023

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    Here is an update. This works only for your specific example. If the user types a letter into the textbox, the code will look up what position that letter is in. The value of the spin button has to stay in sync with that, because you are using that value as an index to your list of values.

    However, if you use complex data of more than one letter, the textbox change event will fire every time the user types the first letter, and it will not match. I suggest you use a listbox instead of a textbox. Then you don't have to check for errors if the user enters something invalid.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    this works perfectly! Thanks!

  8. #8
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    Quote Originally Posted by 6StringJazzer View Post
    Here is an update. This works only for your specific example. If the user types a letter into the textbox, the code will look up what position that letter is in. The value of the spin button has to stay in sync with that, because you are using that value as an index to your list of values.

    However, if you use complex data of more than one letter, the textbox change event will fire every time the user types the first letter, and it will not match. I suggest you use a listbox instead of a textbox. Then you don't have to check for errors if the user enters something invalid.
    The example you made only works for textvalue character length what if you have more than 1 character? a word perhaps

  9. #9
    Registered User
    Join Date
    12-08-2010
    Location
    Philippines
    MS-Off Ver
    Office 365
    Posts
    76

    Re: Help with Spin Button. Set Spin button starting value based on a text box value

    nevermind I got it. It has something to do with data type. thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Only accept integers in a text box with linked spin button
    By TPDave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2014, 11:06 AM
  2. Macro based on Spin Button Linked cell value
    By turist in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2013, 11:57 AM
  3. [SOLVED] Macro based on Spin Button Linked cell value
    By turist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2013, 04:07 PM
  4. [SOLVED] Spin button and text box
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-27-2013, 02:05 PM
  5. Spin Button:spin cells A7
    By ice in forum Excel General
    Replies: 1
    Last Post: 03-16-2007, 02:23 PM

Tags for this Thread

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