Private
Sub
CommandButton1_Click()
Static
cnt
As
Long
Dim
Stadtteil
As
Integer
Dim
ganzerSatz
As
String
Dim
Straße1
As
Integer
Dim
Straße2
As
Integer
Dim
Straße3
As
Integer
Dim
Straße4
As
Integer
Const
Untergrenze
As
Integer
= 2
Const
Obergrenze
As
Integer
= 707
Dim
x
As
Integer
Dim
Zähler
As
String
If
cnt >= 5
Then
GoTo
Neustart
If
CheckBox1.Value =
True
Or
CheckBox2.Value =
True
Or
CheckBox3.Value =
True
Or
CheckBox4.Value =
True
Then
If
Worksheets(
"Tabelle2"
).Cells(Straße1,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Then
If
CheckBox1.Value =
True
Then
CB2:
If
Worksheets(
"Tabelle2"
).Cells(Straße2,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Then
If
CheckBox2.Value =
True
Then
CB3:
If
Worksheets(
"Tabelle2"
).Cells(Straße3,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Then
If
CheckBox3.Value =
True
Then
CB4:
If
Worksheets(
"Tabelle2"
).Cells(Straße4,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Then
If
CheckBox4.Value =
True
Then
TextBox7.Text = TextBox7.Text + 5
Else
TextBox7.Text = TextBox7.Text + 2
End
If
End
If
TextBox7.Text = TextBox7.Text + 5
Else
TextBox7.Text = TextBox7.Text + 2
End
If
Else
:
GoTo
CB4
End
If
TextBox7.Text = TextBox7.Text + 5
Else
TextBox7.Text = TextBox7.Text + 2
End
If
Else
:
GoTo
CB3
End
If
TextBox7.Text = TextBox7.Text + 5
Else
TextBox7.Text = TextBox7.Text + 2
End
If
Else
:
GoTo
CB2
End
If
CheckBox1.Value =
False
CheckBox2.Value =
False
CheckBox3.Value =
False
CheckBox4.Value =
False
Randomize Timer
Stadtteil = Int((Obergrenze - Untergrenze + 1) * Rnd + Untergrenze)
ganzerSatz =
"Welche der nachfolgenden Straßen gehören zu dem Stadtteil "
& Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
) &
"?"
TextBox1.Text = ganzerSatz
Do
Do
Straße1 = Int((Obergrenze - Untergrenze + 1) * Rnd + Untergrenze)
CheckBox1.Caption = Worksheets(
"Tabelle2"
).Cells(Straße1,
"B"
)
Straße2 = Int((Obergrenze - Untergrenze + 1) * Rnd + Untergrenze)
CheckBox2.Caption = Worksheets(
"Tabelle2"
).Cells(Straße2,
"B"
)
Straße3 = Int((Obergrenze - Untergrenze + 1) * Rnd + Untergrenze)
CheckBox3.Caption = Worksheets(
"Tabelle2"
).Cells(Straße3,
"B"
)
Straße4 = Int((Obergrenze - Untergrenze + 1) * Rnd + Untergrenze)
CheckBox4.Caption = Worksheets(
"Tabelle2"
).Cells(Straße4,
"B"
)
Loop
Until
Straße1 <> Straße2 <> Straße3 <> Straße4
Loop
Until
Worksheets(
"Tabelle2"
).Cells(Straße1,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Or
Worksheets(
"Tabelle2"
).Cells(Straße2,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Or
Worksheets(
"Tabelle2"
).Cells(Straße3,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Or
Worksheets(
"Tabelle2"
).Cells(Straße4,
"C"
) = Worksheets(
"Tabelle2"
).Cells(Stadtteil,
"C"
)
Else
UserForm10.Show
cnt = cnt - 1
End
If
Neustart:
cnt = cnt + 1
If
cnt <= 4
Then
x = cnt + 1
Zähler =
"Frage "
& x &
" von 5"
Label4.Caption = Zähler
End
If
If
cnt = 5
Then
CommandButton1.Caption =
"Noch mal?"
CommandButton2.Caption =
"Punkte einlösen"
CheckBox1.Caption =
""
CheckBox1.Enabled =
False
CheckBox2.Caption =
""
CheckBox2.Enabled =
False
CheckBox3.Caption =
""
CheckBox3.Enabled =
False
CheckBox4.Caption =
""
CheckBox4.Enabled =
False
TextBox1.Text =
""
End
If
If
cnt = 6
Then
Unload
Me
Unload UserForm8
UserForm8.Show
End
If
End
Sub