+ Reply to Thread
Results 1 to 14 of 14

Hide/Unhide Userform Text Box Based on Condition

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Hide/Unhide Userform Text Box Based on Condition

    I have a user form with two option buttons (not framed). If the user selects the first user button, I want a label and a textbox to appear on the form. I have written two snippets of VBA; the first hides the label and a textbox on form initialization. The second sub is to make the label and textbox visible upon selection of OptionButton1. This is the part of the code that is not working.

    Form initialization code (working):

    Please Login or Register  to view this content.
    The second sub, however, isn't:

    Please Login or Register  to view this content.
    Anyone have any ideas?

  2. #2
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    BTW, the "End With" in the second pieces is an End If.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide/Unhide Userform Text Box Based on Condition

    the sub refers to RadioButton_Change
    but the if condition refers to OptionButton1

    change one to refer to what the control is actually named
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    Thank you. I changed the code to your suggestion:

    Please Login or Register  to view this content.
    However, the textbox and label still do not show.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    What about making visible
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    Hi sintek:

    Tried your suggestion, no luck.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    Just noticed/checked: Surely this is the event you looking for
    Please Login or Register  to view this content.
    Last edited by sintek; 05-15-2017 at 09:32 AM.

  8. #8
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    Alas, no. I still cannot get that textbox to appear.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    Are you using userform or Active x control buttons

  10. #10
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    Here is a link to the file. The form in question is UserForm2.

    https://www.dropbox.com/s/xxt2nar4fq...del4.xlsm?dl=0

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    ....................Deleted.......................
    Last edited by sintek; 05-15-2017 at 09:52 AM.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    This should work.....
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-30-2012
    Location
    North Carolina
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Hide/Unhide Userform Text Box Based on Condition

    sintek:

    That finally did the trick. Added comparable code in a sub OptionButton2 to make the textbox hidden when the second button is selected. Now all working as planned.

    Thanks for your assistance.

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide/Unhide Userform Text Box Based on Condition

    Pleasure...Gad you got it working....
    Thanks for rep points....

+ 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] Macro for Hide Or Unhide Rows based on Cell Text
    By Neilesh Kumar in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 04-26-2017, 12:03 PM
  2. Macro for Hide Or Unhide Rows based on Cell Text
    By Neilesh Kumar in forum Excel General
    Replies: 3
    Last Post: 04-14-2017, 08:36 AM
  3. [SOLVED] Hide/Unhide text box based on cell value with real-time data from arduino
    By art_a_game in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-12-2016, 05:29 AM
  4. Userform/checkbox hide/unhide rows based on cell value
    By MOHAMMESALMAN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2015, 03:17 AM
  5. [SOLVED] Hide and unhide text box based on a cell value - 2
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2015, 06:59 PM
  6. [SOLVED] hide or unhide rows based on text within a drop down list
    By souimet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 01:32 AM
  7. How to Hide/Unhide rows based on condition
    By Kfir7 in forum Excel General
    Replies: 33
    Last Post: 01-07-2013, 12:55 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