Search code examples
exceluserformvba

Linked checkboxes in Userform and Worksheet


I have a table format questionnaire to be filled on Userform. There are some sections that to be answered only by check-boxes.Those check-boxes are exist in both worksheet and userform. When the user click the box in the userform it need to be ticked in worksheet as well(I don't know if it is possible).


Solution

  • You can write some If statements to assign the same value to the worksheet checkbox on the click or change event of the UserForm checkbox.

    Something like:

    Private Sub CheckBox1_Click()
    
        If Me.CheckBox1.Value = True Then
            ThisWorkbook.Sheets(1).CheckBox1.Value = True
        ElseIf Me.CheckBox1.Value = False Then
            ThisWorkbook.Sheets(1).CheckBox1.Value = False
        End If
    
    End Sub