Hello,
I am using checkboxes for the users to choose one of the options given. My problem is, the checkbox does not uncheck after the data has been inserted into the intended spreadsheet. Means, I have to use command button with clearform instruction to clear the checkbox.

How do I uncheck the checkbox after the data has been inserted without having to use the clearform control?

These are the codes I am using for one of the checkbox option in my coding.

If Me.FourPPMCheckBox1.Value = True Then
        emptyRow = ws3.Cells(ws3.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        With ws3
            .Cells(emptyRow, 1).Value = Me.PlannedDateTextBox.Value
            .Cells(emptyRow, 2).Value = Me.PlannedMonthComboBox.Value
        End With
        For x = 2 To 9
            If Me.PlannedYearComboBox.Value = "200" & x Then ws3.Cells(emptyRow, x + 1).Value = Me.PlannedDurationTextBox.Value
        Next x
        For x = 10 To 20
            If Me.PlannedYearComboBox.Value = "20" & x Then ws3.Cells(emptyRow, x + 1).Value = Me.PlannedDurationTextBox.Value
        Next x
        ws3.Cells(emptyRow, 22).Value = Me.PlannedRemarksTextBox.Value
        Me.PlannedDateTextBox.Text = ""
        Me.PlannedMonthComboBox.Text = ""
        Me.PlannedYearComboBox.Text = ""
        Me.PlannedDurationTextBox = ""
        Me.PlannedRemarksTextBox = ""
    End If

Thank you in advance.

Simply place the following code in your clear or insert command.

MyCheckBox.Checked = False

But note that this will fire any CheckChanged event handler for that CheckBox.

Im suprised these two commands didn't throw errors.

        Me.PlannedDurationTextBox = ""
        Me.PlannedRemarksTextBox = ""

Anyway I do not see where you are calling
Me.FourPPMCheckBox1.Value = False

Hello Beginnerdev and kRod

I have already inserted the command
Me.FourPPMCheckBox1.Value =False
in the other part of the coding. But it still didn't work. So does it mean that I have to put the command in the codes that I have shown to u guys? Because, I've tried it but it says error.

You need to put it where it can be called as needed. Where ever your logic calls for it.

Me.FourPPMCheckBox1.Value = True 'Is Wrong
Me.FourPPMCheckBox1.Checked = False 'Is what you are wanting 

Also make sure as Begginnerdev has said you dont have a CheckChanged Event coded to undo what you are wanting

I've inserted the command that you've given me. But it still doesn't work. I mean, after I've inserted the data, (after the user click OK button) the box is still checked while the other variables in the userform has been emptied. This could cause confusion for the users.

How do I unchecked the box once the user click OK button so that the userform would appear as new?

I hope I've made it clear.

Do you have any code in the CheckBox_CheckChanged event?

Do you have a sub procedure called CheckBox1_CheckChanged that handles the CheckChanged event of the checkbox?

It is possible that something else is checking that checkbox.

Is the checkbox a custom control that has been extended from the CheckBox control?

You can do a mass uncheck by looping through the form for each checkbox:

For Each cb As CheckBox in Me.Controls
    cb.Checked = False
Next

I think this is what you are wanting?

If you still can't find what's Checking Your CheckBox Try right-clicking on the CheckBox in Code and selecting "Find All References" go through each one and see where your CheckBox is being checked. It sounds like you have some code out of order. Also you could step through the code with the debugger to see when & where you are Checking the Mis-Behaved CheckBox.

commented: It's not easy being cheesy. +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.