Gruppe
Dialog
Problem
Die CheckBoxes im Bereich A1:F10 sollen auf ihren Wert hin geprüft werden.
StandardModule: basMain
Sub CheckBoxActivate()
Dim arr() As String
Dim ole As OLEObject
Dim iCounter As Integer
For Each ole In ActiveSheet.OLEObjects
If Not Intersect( _
ole.BottomRightCell, Range("A1:F10")) Is Nothing And _
TypeName(ole.Object) = "CheckBox" Then
If ole.Object.Value = True Then
iCounter = iCounter + 1
ReDim Preserve arr(1 To iCounter)
arr(iCounter) = ole.Name
End If
End If
Next ole
If iCounter = 0 Then
Beep
MsgBox "Keine aktivierten CheckBoxes gefunden!"
Exit Sub
End If
For iCounter = 1 To UBound(arr)
MsgBox arr(iCounter)
Next iCounter
End Sub