+ Reply to Thread
Results 1 to 5 of 5

Userform Option Button to Show/Hide Another Option Button on same Userform

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Question Userform Option Button to Show/Hide Another Option Button on same Userform

    Hi All,

    I have a userform that has two checkboxes - 'OBTCL' & 'OBNAS'. When the value of 'OBTCL' is true I would like it to show an Option Button 'OBLabel'. If false then hide 'OBLabel'
    All the above are on the same userform - 'UserForm1'.

    I have tried the following:
    Please Login or Register  to view this content.
    The above still shows 'OBLabel. I'm also not sure if i have put the code in the correct Sub, 'UserForm1_Initialise'?

    Any help on the above would be appreciated as always.
    Cheers,
    Mark
    Last edited by R_S_6; 08-27-2010 at 02:31 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    19,868

    Re: Userform Option Button to Show/Hide Another Option Button on same Userform

    The initialize event of a userform has this signature.

    Please Login or Register  to view this content.
    It does not include the userform name nor is initialize spelt with a s.

    So that would suggest you created that routine and as you suspect it is not exectued when the userform loads.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Re: Userform Option Button to Show/Hide Another Option Button on same Userform

    Thanks Andy.

    I have made those mods and a few others:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    It now opens with the workbook and doesn't show the 'OBLabel'. Unfortunately it also doesn't show it when I select 'OBTCL'...

    Any Ideas? Thanks for your help.
    Mark

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    19,868

    Re: Userform Option Button to Show/Hide Another Option Button on same Userform

    If the only place you are altering the Visible property is in the initialize event then it will not appear as suspect the default values of the checkbox are such that the label should not appear.

    You would also need to check the status of things whenever the checkbox values change. So you would need code in their change events.

  5. #5
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Smile Re: Userform Option Button to Show/Hide Another Option Button on same Userform

    Okay I think I have it working. When I wrote the original post I wrote Checkboxes as opposed to Option Buttons. Thus there were three optionboxes and when one was active it didnt like another being active.

    To solve: I changed OBLabel to a checkbox, 'CBLabel'.
    Here is the working code:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Thanks again for your help Andy - great information & help as always!
    Mark

+ 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