
Sub chBox_value()
Dim sp As Object
For Each sp In ActiveSheet.DrawingObjects
If TypeName(sp) = "OLEObject" And sp.Value = True Then
MsgBox sp.Name
End If
Next
End Sub
请问如何处理,谢谢!
如果是窗体复选框 代码如下:
Sub test()
Dim i, j As Byte
For Each chk In ActiveSheet.CheckBoxes
If chk = xlOn Then
j = j + 1
a = a & ","闷枝 & chk.Text
End If
Next
MsgBox "共选中:" & j & "个复选框" & vbCrLf & "分别是:" & a
End Sub
如果是旁亩控件工具箱的复选框
Sub test1()
Dim i, j As Byte
For Each chk In ActiveSheet.OLEObjects
With chk.Object
If InStr(.Caption, "运罩森CheckBox") > 0 Then
If .Value = True Then
j = j + 1
a = a & "," & .Caption
End If
End If
End With
Next
MsgBox "共选中:" & j & "个复选框" & vbCrLf & "分别是:" & a
End Sub