+ Reply to Thread
Results 1 to 3 of 3

Referencing Option Button Group?

Hybrid View

Jmoo Referencing Option Button... 06-10-2010, 11:00 AM
romperstomper Re: Referencing Option Button... 06-10-2010, 11:10 AM
Jmoo Re: Referencing Option Button... 06-10-2010, 11:25 AM
  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Referencing Option Button Group?

    Hey All,

    I'm slightly new to using UserForms and Radio/Option buttons.

    I have 5 option buttons on UserForm1 name oB1, oB2,oB3, oB4,oB5.

    They all have a GroupName of "oBgroup".

    Now when I select one of those buttons. Can I reference the group name and see which option is selected?

    I have tried this within another CommandButton_Click function that is also on UserForm1

    Private Sub CommandButton1_Click()
        MsgBox (UserForm1.oBgroup.Value)
    End Sub
    However, I get the error "Method or Data member not found"

    I know, I'm just referencing it slightly wrong. Any help would be greatly appreciated!

    Thanks,

    Jay

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Referencing Option Button Group?

    You can use a Select Case statement:
    
    Private Sub CommandButton1_Click()
        Select Case True
           Case oB1
              MsgBox "option1"
           Case oB2
              MsgBox "option2"
           Case oB3
              MsgBox "option3"
           Case oB4
              MsgBox "option4"
           Case oB5
              MsgBox "option5"
        End Select
    End Sub
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    06-10-2010
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Referencing Option Button Group?

    I guess that would work.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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