Option
Compare Text
Private
del
As
Boolean
Private
Sub
worksheet_change(
ByVal
Target
As
Range)
With
ThisWorkbook.Sheets(
"Darts"
)
If
Not
del
Then
If
Target.Value =
"DEL"
Then
del =
True
Target.Value =
""
.Copy After:=Sheets(1)
Sheets(2).Name =
"Game "
& Format(Now(),
"hh.nn, dd.mm.yyyy"
)
If
Sheets.Count > 10
Then
Application.DisplayAlerts =
False
Sheets(11).Delete
Application.DisplayAlerts =
True
End
If
.Activate
.Range(
"A6:H"
& .Rows.Count).Value =
""
.Range(
"B5"
).Value =
""
.Range(
"D5"
).Value =
""
.Range(
"F5"
).Value =
""
.Range(
"H5"
).Value =
""
.Range(
"B5"
).
Select
del =
False
ElseIf
Target.Value =
"SCORE"
Then
del =
True
.Range(
"M2:M100"
).Value =
""
Target.Value =
""
del =
False
Else
If
Target.row > 5
And
Target.Column
Mod
2 = 1
Then
Reihe getätigt wurde
Dim
inte
As
Boolean
Dim
r
As
Integer
, c
As
Integer
, t
As
Integer
, todo
As
Integer
t = .Range(
"D1"
).Value
r = Target.row
c = Target.Column
On
Error
GoTo
falsch
Dim
v
As
Integer
v = Target.Value
inte =
True
If
v >= 0
And
v <= 60
Then
If
Target.row
Mod
3 = 2
Then
If
r = 8
Then
.Cells(r, c + 1).Value = t - .Cells(r - 2, c).Value - .Cells(r - 1, c).Value - .Cells(r, c).Value
.Cells(r - 1, c + 1).Value = (t - .Cells(r, c + 1).Value) / 3
Else
.Cells(r, c + 1).Value = .Cells(r - 3, c + 1).Value - .Cells(r - 2, c).Value - .Cells(r - 1, c).Value _
- .Cells(r, c).Value
.Cells(r - 1, c + 1).Value = (t - .Cells(r, c + 1).Value) / (r - 5)
If
.Cells(r, c + 1).Value < 0
Then
MsgBox
"Bust!"
todo = .Cells(r - 3, c + 1).Value
If
todo - .Cells(r - 2, c).Value = 0
Then
.Cells(r - 1, c).Value = 0
.Cells(r, c).Value = 0
ElseIf
todo - .Cells(r - 2, c).Value - .Cells(r - 1, c).Value = 0
Then
.Cells(r, c).Value = 0
ElseIf
todo - .Cells(r, c).Value - .Cells(r - 1, c).Value - .Cells(r - 2, c).Value < 0
Then
.Cells(r - 2, c).Value = 0
.Cells(r - 1, c).Value = 0
.Cells(r, c).Value = 0
End
If
ElseIf
.Cells(r, c + 1).Value = 0
Then
MsgBox
"Sieger: "
& .Cells(5, c + 1).Value
Dim
i
As
Integer
i = 2
While
.Cells(i, 12).Value <> .Cells(5, c + 1).Value
i = i + 1
Wend
.Cells(i, 13).Value = .Cells(i, 13).Value + 1
.Cells(1, 6).Value =
"DEL"
Exit
Sub
End
If
End
If
.Cells(r - 2, c + 2).
Select
r = r - 2
c = c + 2
If
.Cells(5, c + 1) =
""
Then
.Cells(r + 3, 1).
Select
End
If
End
If
Else
MsgBox
"Sie können keine so hohe Zahl werfen!"
Target.
Select
End
If
falsch:
If
Not
inte
Then
MsgBox
"Bitte geben Sie nur Ganzzahlen ein!"
Target.
Select
End
If
End
If
End
If
End
If
End
With
End
Sub