Check box to select and deselect all other check boxes in spreadsheet

后端 未结 1 1340
臣服心动
臣服心动 2021-01-26 20:22

I have a spreadsheet that pulls line items in with check boxes for each line item. I would like to put a check box at the top that will select and deselect all the other check b

相关标签:
1条回答
  • 2021-01-26 20:47
    Sub SelectAllCheckBox()
        Dim CB As CheckBox
    
        For Each CB In ActiveSheet.CheckBoxes
            If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
                CB.Value = ActiveSheet.CheckBoxes("Check Box 1").Value
            End If
        Next CB
    
    End Sub
    

    Second part:

    Dim CB as CheckBox, n as long, x as long
    
    n = ActiveSheet.CheckBoxes.Count
    
    For x = n to 1 Step -1        
        Set CB = ActiveSheet.CheckBoxes(x)
        If CB.Name <> "Check Box 1" Then CB.Delete
    
    Next x
    
    0 讨论(0)
提交回复
热议问题