try changing:
If CheckBox.Value = False Then
to:
If CheckBox.Value = xlOff Then
You could also reduce your looping a bit:Sub CommandButton1_Click() Dim ws As Worksheet, CheckBox, c For Each CheckBox In CheckBoxes If CheckBox = xlOff Then Set ws = Nothing On Error Resume Next Set ws = Sheets(CheckBox.Caption) On Error GoTo 0 If Not ws Is Nothing Then For c = 1 To ws.Cells(Rows.Count, 8).End(xlUp).Offset(1, 0).Row 'if not checked, looks on current worksheet (within loop) and if any "Y" or "y" vals, clears them If Application.Trim(UCase(ws.Range("H" & c).Value)) = "Y" Then ws.Range("H" & c).ClearContents 'caters for upper and lower case and leading/trailing spaces. Next End If End If Next CheckBox End Sub





Reply With Quote
