PDA

View Full Version : Option Buttons



bujaman
10-07-2007, 01:05 AM
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.

Bob Phillips
10-07-2007, 01:13 AM
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

bujaman
10-07-2007, 10:53 PM
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?)