Option
Explicit
Private
Sub
Workbook_SheetChange(
ByVal
Sh
As
Object
,
ByVal
Target
As
Range)
Select
Case
Sh.Name
Case
"Übersicht"
Exit
Sub
End
Select
On
Error
GoTo
ErrHandler
Application.EnableEvents =
False
With
Sh
If
Not
Intersect(Target, .Range(
"A1"
))
Is
Nothing
Then
.Range(
"B1"
).Value = .Range(
"B1"
).Value + .Range(
"A1"
).Value
End
If
.Range(
"A1"
).Value = 0
End
With
With
Worksheets(
"Übersicht"
)
.Range(
"A1"
).Value = .Range(
"A1"
).Value + 1
End
With
Call
MsgBox(
"Workbook_SheetChange() des Blattes '"
& Sh.Name &
"'"
, vbInformation)
SafeExit:
Application.EnableEvents =
True
Exit
Sub
ErrHandler:
Call
MsgBox(
"Workbook_SheetChange()"
& vbNewLine & vbNewLine & _
Err.Description, vbCritical, _
"Fehler "
& Err.Number)
GoTo
SafeExit
End
Sub