Multiple userform checkbox values

aclark11

New Member
Joined
Jan 4, 2023
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
I am trying to take the values passed from a userform that has the following checkbox options and write them to a single concatenated cell. Thank you for your help. Any suggestions would be greatly appreciated. I currently have attempted this, but can only get one option to show up at a time.

Scenario Options and Userform Output Cells:

Scenario Options and Userform Output Cells


Userform:
userform


VBA Code:
Private Sub CheckBox1_Click()

If Me.CheckBox1.Value = True Then
    Me.Frame2.Visible = True
    Sheets("Project Analysis - Summary").Range("D7") = 1
Else
    Me.Frame2.Visible = False
End If

End Sub

Private Sub CheckBox2_Click()

If Me.CheckBox2.Value = True Then
    Me.Frame3.Visible = True
    Sheets("Project Analysis - Summary").Range("D8") = 1
Else
    Me.Frame3.Visible = False
End If

End Sub

Private Sub CheckBox3_Click()

If Me.CheckBox3.Value = True Then
    Me.Frame4.Visible = True
    Sheets("Project Analysis - Summary").Range("D9") = 1
Else
    Me.Frame4.Visible = False
End If

End Sub

Private Sub CheckBox5_Click()

If Me.CheckBox5.Value = True Then
    Me.Frame6.Visible = True
    Sheets("Project Analysis - Summary").Range("D10") = 1
Else
    Me.Frame6.Visible = False
End If

End Sub

Private Sub CheckBox6_Click()

If Me.CheckBox6.Value = True Then
    Me.Frame5.Visible = True
    Sheets("Project Analysis - Summary").Range("D11") = 1
Else
    Me.Frame5.Visible = False
End If

End Sub

Private Sub CommandButton1_Click()

Dim ctrl1 As Control

Set ctrl1 = Nothing
    
For Each ctrl1 In Me.Frame2.Controls
    If TypeName(ctrl1) = "OptionButton" And ctrl1.Value = True Then
        Sheets("Project Analysis - Summary").Range("E7") = ctrl1.Caption
    End If
Next

Dim ctrl2 As Control

Set ctrl2 = Nothing
    
For Each ctrl2 In Me.Frame3.Controls
    If TypeName(ctrl2) = "OptionButton" And ctrl2.Value = True Then
        Sheets("Project Analysis - Summary").Range("E8") = ctrl2.Caption
    End If
Next

Dim ctrl3 As Control

Set ctrl3 = Nothing
    
For Each ctrl3 In Me.Frame4.Controls
    If TypeName(ctrl3) = "OptionButton" And ctrl3.Value = True Then
        Sheets("Project Analysis - Summary").Range("E9") = ctrl3.Caption
    End If
Next

Dim ctrl4 As Control

Set ctrl4 = Nothing
    
For Each ctrl4 In Me.Frame5.Controls
    If TypeName(ctrl4) = "OptionButton" And ctrl4.Value = True Then
        Sheets("Project Analysis - Summary").Range("E10") = ctrl4.Caption
    End If
Next

Dim ctrl5 As Control

Set ctrl5 = Nothing
    
For Each ctrl5 In Me.Frame6.Controls
    If TypeName(ctrl5) = "OptionButton" And ctrl5.Value = True Then
        Sheets("Project Analysis - Summary").Range("E11") = ctrl5.Caption
    End If
Next

End Sub


Private Sub UserForm_Initialize()

Me.Frame2.Visible = False
Me.Frame3.Visible = False
Me.Frame4.Visible = False
Me.Frame5.Visible = False
Me.Frame6.Visible = False
Sheets("Project Analysis - Summary").Range("D7") = ""
Sheets("Project Analysis - Summary").Range("D8") = ""
Sheets("Project Analysis - Summary").Range("D9") = ""
Sheets("Project Analysis - Summary").Range("D10") = ""
Sheets("Project Analysis - Summary").Range("D11") = ""
Sheets("Project Analysis - Summary").Range("E7") = ""
Sheets("Project Analysis - Summary").Range("E8") = ""
Sheets("Project Analysis - Summary").Range("E9") = ""
Sheets("Project Analysis - Summary").Range("E10") = ""
Sheets("Project Analysis - Summary").Range("E11") = ""

End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Ideally, a combination of financing scenarios could be selected separated by a comma. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top