假设您的复选框如下图所示放置。我故意没有对齐它们。

好的,这是我们将使用的一个小技巧。右键单击所有复选框,column 1然后单击Format Control。接下来转到Alt Text选项卡并键入1。对于第 2 列复选框,输入2. Alt text对所有 15 列重复此操作。

现在将下面的宏分配给所有顶部的复选框。
Sub CheckBox_Click()
Dim shp As Shape, MainShp As Shape
Dim Alttext As String
'~~> Get the checkbox which called the macro
Set MainShp = ActiveSheet.Shapes(Application.Caller)
'~~> Get it's alternate text
Alttext = MainShp.AlternativeText
'~~> Loop through all checkboxes except the checkbox which called it
'~~> and check for their alt text
For Each shp In ActiveSheet.Shapes
If shp.Name <> MainShp.Name And shp.AlternativeText = Alttext Then
'~~> If the top checkbox is checked then set the rest as checked
If MainShp.OLEFormat.Object.Value = 1 Then
shp.OLEFormat.Object.Value = 1
Else
shp.OLEFormat.Object.Value = 0
End If
End If
Next
End Sub
现在,当您单击最顶部的复选框时,它将检查下面Alt text与顶部复选框相同的所有复选框。