+ Reply to Thread
Results 1 to 6 of 6

Optionbutton

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2007
    Posts
    50

    Optionbutton

    Hi

    I have a userform and the optionbutton in it. When I click (with the mouse) on it, it becomes CHOOSEN. If I click it again, it shoud become NOT CHOOSEN, but it is not so.
    How to make it?

  2. #2
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi olio39,

    Why not use the check box instead or if you want you can paste this code in the userform.

    Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
         OptionButton1.Value = 0
    End Sub
    If you double click the userform, option 1 will unselect.
    Corine

  3. #3
    Registered User
    Join Date
    01-22-2007
    Posts
    50
    Hi Corinereyes

    Thanks for the advise, you are right, checkbox will be the right solution for my case.

    Have a nice day

  4. #4
    Registered User
    Join Date
    08-16-2007
    Location
    Portsmouth, UK
    Posts
    86
    If you did want to use a command button you could always use something like the following to change the caption

    Private Sub CommandButton1_Click()
        With CommandButton1
            If .Caption = "Not Chosen" Then
               .Caption = "Chosen"
            Else
                .Caption = "Not Chosen"
            End If
        End With
    End Sub
    That way you would be able to toggle the caption on the button and then write different code depending on the button's caption

  5. #5
    Registered User
    Join Date
    08-16-2007
    Location
    Portsmouth, UK
    Posts
    86
    Oops sorry ignore that, I'm not talking about option buttons at all am I?! Sorry it's early I'm still half asleep, will remember to read posts properly before replying in future.

    Sorry

  6. #6
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    I think you need to use checkbox.

    Regards,
    Antonio

+ 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