Option
Explicit
Const
iCount
As
Long
= 10 ^ 4
Private
Sub
cmdExit_Click()
Unload
Me
End
Sub
Private
Sub
cmdGo_Click()
Call
main
End
Sub
Private
Sub
UserForm_Initialize()
Dim
i
As
Long
Dim
t
t = Timer
For
i = 1
To
10000
Me
.Controls.Add
"Forms.Checkbox.1"
DoEvents
Next
i
Debug.Print
"############################################################"
Debug.Print
"## Schleifenzähler:= 1 To 10 ^ 4 #####"
Debug.Print
"############################################################"
Debug.Print
"[CheckBoxen zur Laufzeit erzeugen] "
, Format(Timer - t,
"00:00:00.000000"
) &
"sek"
End
Sub
Sub
main()
Dim
t
UserForm1.Caption =
"Läuft..."
t = Timer:
Call
ForEachTypeName
Debug.Print
"[ForEachTypeName] "
, Format(Timer - t,
"00:00:00.000000"
) &
"sek"
t = Timer:
Call
ForEachTypeOf
Debug.Print
"[ForEachTypeOf] "
, Format(Timer - t,
"00:00:00.000000"
) &
"sek"
t = Timer:
Call
ForI
Debug.Print
"[ForI] "
, Format(Timer - t,
"00:00:00.000000"
) &
"sek"
UserForm1.Caption =
"Fertig"
End
Sub
Sub
ForEachTypeName()
Dim
ctl
As
MSForms.Control
For
Each
ctl
In
UserForm1.Controls
If
TypeName(ctl) =
"CheckBox"
Then
ctl.Value =
False
End
If
Next
ctl
End
Sub
Sub
ForEachTypeOf()
Dim
ctl
As
MSForms.Control
For
Each
ctl
In
UserForm1.Controls
If
TypeOf
ctl
Is
MSForms.CheckBox
Then
ctl.Value =
False
End
If
Next
ctl
End
Sub
Sub
ForI()
Dim
i
As
Long
For
i = 1
To
10000
Me
.Controls(
"CheckBox"
& i).Value =
False
Next
End
Sub