Hello
in this file I have command button to clear all of data in sheet2 when and make all of checkboxes are false , but I want when make any check box is false, then should delete the column, just the checkbox is false and ignore the others are true .
I add this by call from every checkbox but doesn't work
Private Sub ForAllCheckBoxes(ChkBox As Control)
Dim fndHead As Range
If ChkBox.Value = False Then
With sh2
Set fndHead = .Rows("1:1").Find(What:=ChkBox.Caption, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False)
If Not fndHead Is Nothing Then
.Columns(fndHead.Column).Delete
End If
End With
End If
End Sub
Private Sub CheckBox1_Click()
With CheckBox1
If .Value = True Then Call CopyColumn(.Caption)
If .Value = False Then Call ForAllCheckBoxes
End With
End Sub