Option
Explicit
Private
Sub
Worksheet_BeforeDoubleClick(
ByVal
Target
As
Range, Cancel
As
Boolean
)
Dim
objRange
As
Range, objCell
As
Range
Dim
lngCount
As
Long
Set
objRange = Cells(1, 1).Resize(10, 10)
If
Not
Intersect(Target, objRange)
Is
Nothing
Then
For
Each
objCell
In
objRange
If
objCell.Interior.Color = vbGreen
Then
_
lngCount = lngCount + 1
If
lngCount = 14
Then
Call
MsgBox(
"Es sind bereits "
& lngCount &
" Zellen gefärbt!"
, vbExclamation)
Exit
For
End
If
Next
If
Not
objCell
Is
Nothing
Then
Set
objCell =
Nothing
Else
Target.Interior.Color = vbGreen
End
If
End
If
Set
objRange =
Nothing
End
Sub