Consulting

Results 1 to 3 of 3

Thread: Option Buttons

  1. #1
    VBAX Regular
    Joined
    Oct 2007
    Posts
    13
    Location

    Option Buttons

    I am building a spreadsheet to keep track of my bank accounts and how i move money to and from accounts. I am using a userform with combo boxes and multiple optionbuttons. I have one optionbutton set for account (Wells Fargo Checking, etc.) and another for type of transaction (Deposit, withdraw, transfer). If transfer is selected another combobox becomes active and you can select the account you are transfering to. I want to select an account from that box and when I post the transaction, have it pull the name property value from the selected optionbutton and put it into a cell in excel, anyone have any idea on how to do this? I would love and appreciate any help. Thanks.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim ctl As MSForms.Control
    For Each ctl In Me.Controls
    If TypeName(ctl) = "OptionButton" Then
    If ctl.Value Then
    MsgBox ctl.Name
    Exit For
    End If
    End If
    Next ctl
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Oct 2007
    Posts
    13
    Location

    Thanks

    Thanks for that code, I got it to work for one set of my optionbuttons, however, I have multiple groups of optionbuttons and was wondering if anyone knows how to get the selected optionbuttons name from each group (ie three groups, one optionbutton from each group selected, how can you get the name property for each selected button?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •