Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Radio Button Group value using VBA
Hello,
I have a small issue in trying to find out if one of the radio buttons in the group of radio buttons is clicked. i.e.: Group: radioGrp1 Radio Button 1: radioBtn1 Radio Button 2: radioBtn2 Radio Button 3: radioBtn3 Command Button: cmdBtn What value should be expected from the group if a user selects one of the radio buttons after the user clicks on the Command Button. The radio buttons are all "unclicked" upon form load and the Command Button just validates that the user has selected on of the radio buttons. Thank you for your help. --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Radio Button Group value using VBA
Hello,
I have a small issue in trying to find out if one of the radio buttons in the group of radio buttons is clicked. i.e.: Group: radioGrp1 Radio Button 1: radioBtn1 Radio Button 2: radioBtn2 Radio Button 3: radioBtn3 Command Button: cmdBtn What value should be expected from the group if a user selects one of the radio buttons after the user clicks on the Command Button. The radio buttons are all "unclicked" upon form load and the Command Button just validates that the user has selected on of the radio buttons. write the following procedure into the code module from the UserForm: Private Sub cmdBtn_Click() MsgBox CheckOptionButton(Me, "radioGrp1") End Sub And this function in a standard module: Function CheckOptionButton(objForm As Object, strGroupName As String) _ As String Dim ctrl As Control For Each ctrl In objForm.Controls If TypeName(ctrl) = "OptionButton" Then If ctrl.GroupName = strGroupName And ctrl.Value Then CheckOptionButton = ctrl.Caption ' reset OptionButton ctrl.Value = False End If End If Next ctrl End Function -- Regards Melanie Breden - Microsoft MVP für Excel - http://excel.codebooks.de (Das Excel-VBA Codebook) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to reset a group Radio button? | Excel Discussion (Misc queries) | |||
Help with radio button | Excel Discussion (Misc queries) | |||
"RADIO BUTTON" | Excel Discussion (Misc queries) | |||
How do I lock a radio button group if a N/A button is selected | Excel Discussion (Misc queries) | |||
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True | Excel Worksheet Functions |