Userform checkbox undo the data it's input when unchecked.

Sirico

New Member
Joined
Sep 29, 2021
Messages
10
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
  2. Web
Hi everyone,

I'm designing a userform that uses multiple checkboxes based on shoe sizes.
So the user has to fill in the textboxes and then clicking on the checkboxes for the size will populate a line for each size with all the details.
The problem I'm having is that when I untick a size it only removes the previous line (A place holder because I don't know how to implement the way I want) rather than the line associated with the size, is this even possible?

Also when I reset all the fields on the userform it will display my warning for every checkbox cleared, I have tried putting in
VBA Code:
If ME.CheckBox95k=True Then
just after my ''start note but it doesn't seem to be effective.

Thank you for taking the time to look at the post



I have included the code from one of the check box clicks:

VBA Code:
Private Sub CheckBox10_Click()
'''Input
       
    Dim ws As Worksheet
    Dim LastRow As Long, RowInsert As Long
   
    Set ws = ThisWorkbook.Worksheets("stock")
     With ws
        LastRow = .Cells(Rows.Count, "A").End(xlUp).row
       
        RowInsert = .Range("A1:A" & LastRow).Find("*", .Cells(LastRow, "A"), xlValues, , , xlPrevious).row
        RowInsert = RowInsert + 1
        RowInvert = RowInsert - 1
       
       
   
    'add the uk size input code here
   
  '''Checkbox based search
 
 ''Start
 
   
       
        If Me.comboboxbrand.Value = "" Then
    MsgBox "please enter a brand", vbInformation
        Exit Sub
        End If
       
    If Me.comboboxgender.Value = "" Then
    MsgBox "please enter an item gender", vbInformation
        Exit Sub
        End If
       
    If Me.comboboxclosure.Value = "" Then
    MsgBox "please enter a closure type", vbInformation
        Exit Sub
        End If
       
    If Me.comboboxmaterial.Value = "" Then
    MsgBox "please enter an upper material type", vbInformation
        Exit Sub
        End If
       
    'If Me.comboboxuksize.Value = "" Then
    'MsgBox "please enter the uk size", vbInformation
        'Exit Sub
        'End If
       
     If Me.comboboxmodel.Value = "" Then
    MsgBox "please enter a model type", vbInformation
      
       
       
        ElseIf Me.CheckBox10.Value = True Then
   
  

                                         ''''This has to match the number of rows input below
        .Cells(RowInsert, "A").Resize(1, 8).Value = Array( _
            Me.txtDate.Text, _
            Me.textboxparentsku.Text, _
            Me.comboboxbrand.Text, _
            Me.comboboxclosure.Text, _
            Me.comboboxgender.Text, _
            Me.comboboxmaterial.Text, _
            Me.comboboxmodel.Text, _
            Me.ComboBoxcolour.Text _
        )
        ws.Range("I" & RowInsert).Value = CheckBox10.Caption
       
        ElseIf Me.CheckBox10.Value = False Then .Cells(RowInvert, "A").Resize(1, 9).Value = ""
                                               
   

End If
''Finish

 

   
  
   
   
    Set ws = Nothing

End With
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,479
Messages
5,770,323
Members
425,612
Latest member
martinijr

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
Top