Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
Dim
c
As
Range
Dim
lngZiel
As
Long
Dim
varSuche
As
Variant
If
Not
Intersect(Target, Range(
"D7"
))
Is
Nothing
Then
If
Not
ChkLimit(Target.Value, 2)
Then
Exit
Sub
End
If
End
Sub
Private
Function
ChkLimit(
ByVal
varS
As
Variant
, intMax
As
Integer
)
As
Boolean
Dim
rngfnd
As
Range, c
As
Range
With
Sheets(
"Limit"
).Columns(
"A"
)
Set
rngfnd = .Find(varS, , , xlWhole)
If
Not
rngfnd
Is
Nothing
Then
Set
c = rngfnd.Offset(, 1)
If
c.Value < intMax
Then
c.Value = c.Value + 1
ChkLimit =
True
Else
End
If
Else
MsgBox
"Limit nicht erkannt"
End
If
End
With
End
Function