+ Reply to Thread
Results 1 to 8 of 8

UserForm - How To Make TextBox Value Change Depending On ListBox Selection

  1. #1
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    Hi all,

    I have a userform with a listbox (for the user to select a simple Yes or No), a textbox in which the user enters a number, and a second listbox that I would like to have change value.

    For example, if ListBox21 = yes then TextBox13 = TextBox14 x 2
    ElseIf
    ListBox21 = No Then TextBox 13 = TextBox 14

    I can't seem to get it right - the code I have so far for each item is as follows (I've taken out the bits that haven't worked for me)...
    Please Login or Register  to view this content.
    I don't know if it's just a syntax problem with my code or if I'm simply way off the mark - could someone point me in the right direction?

    Cheers,

    AJ
    Last edited by ScotyB; 11-26-2013 at 05:05 PM. Reason: to mark as solved
    Always grateful for the help here - thanks.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    If I understand you correct try:
    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    Thanks, Solus,

    got a few type mismatch errors, so I changed a few things around, and still no luck. I've attached a dummy file for you to look at and the three boxes in question are the ones shaded in pink on the userform.

    Cheers,

    AJ
    Attached Files Attached Files

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    Is there a reason you're using a listbox instead of option buttons?

  5. #5
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    None at all, Solus (probably just force of habit) - I don't think I've ever used option buttons before; would it be easier that way?

    Cheers,

    AJ

  6. #6
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    Solus,

    to answer my own question, yes, it's easier that way (so easy in fact that it's embarrassing, lol) - thanks for the nudge in the right direction.

    CHeers,

    AJ

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    No problem. Glad to help.

    Have you found a proper solution or should we work on one for option buttons?

  8. #8
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: UserForm - How To Make TextBox Value Change Depending On ListBox Selection

    Solus,

    I seem to have a solution that's working using option buttons, and I tested my userform last night to ensure that all data on the form was being written correctly to a worksheet, so I'm good for now. Thanks for the offer and for taking a look in the first place.

    Cheers,

    AJ

+ 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] Indexing proper range in listbox depending on selection in previous listbox
    By bloodmeat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2013, 02:31 PM
  2. [SOLVED] Fill a cell via textbox on userform depending on combobox selection
    By Rhamilton2512 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2012, 10:29 AM
  3. [SOLVED] How do I make a selection from a combobox on my VBA userform populate a textbox?
    By ChristianMba in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-16-2012, 01:08 PM
  4. [SOLVED] UserForm contains optionbuttons that generate listbox to make selection
    By jbeeball in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-11-2012, 09:34 PM
  5. Change Userform Textbox based on GUI Cell Selection
    By canyon289 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-09-2011, 06:21 PM

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