我的Excel表格中有这么多复选框。我在每个人的检查事件上都叫Common Sub。
是否可以知道在公共Sub中检查了哪个复选框? (所以我 可以采取相应的行动)
答案 0 :(得分:1)
试试这个
Sub CommonClick
Dim cb As CheckBox
On Error Resume Next
Set cb = ActiveSheet.Checkboxes(Application.Caller)
If Err.Number <> 0 Then
MsgBox "Sub not called from a CheckBox on current sheet"
Exit Sub
End If
On Error GoTo 0
MsgBox cb.Name & " was set to " & cb.Value
End Sub