AW: Kommentare überall ausblenden
22.12.2005 09:57:41
Heinz
Hallo Josef
Natürlich hattest Du recht.
Sorry aber das ist jetzt wirklich der Original Code
Danke Heinz
Private Sub Workbook_Open()
With Application
.Calculation = xlCalculationAutomatic
.MaxChange = 0.001
End With
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'2. u. 3. Schicht-Zulagen eintragen, wenn Stunden inm Bereich Normalarbeitszeit eingegeben werden.
On Error GoTo ErrorHandler
If Intersect(Target, Range("$N$13:$AR$20")) Is Nothing Then Exit Sub
If IsEmpty(Target) And _
Application.WorksheetFunction.Sum(Range(Cells(13, Target.Column), Cells(20, Target.Column))) = 0 Then
Application.EnableEvents = False
Cells(37, Target.Column) = ""
Cells(38, Target.Column) = ""
Application.EnableEvents = True
Exit Sub
End If
If Not IsNumeric(Target) Then Exit Sub
If Target = 0 And _
Application.WorksheetFunction.Sum(Range(Cells(13, Target.Column), Cells(20, Target.Column))) = 0 Then
Application.EnableEvents = False
Cells(37, Target.Column) = ""
Cells(38, Target.Column) = ""
Application.EnableEvents = True
Exit Sub
End If
If Cells(10, Target.Column) = 2 Then
Application.EnableEvents = False
Cells(37, Target.Column) = _
Application.WorksheetFunction.Sum(Range(Cells(13, Target.Column), Cells(20, Target.Column)))
If Cells(37, Target.Column) > Cells(9, Target.Column) Then _
Cells(37, Target.Column) = Cells(9, Target.Column)
Application.EnableEvents = True
ActiveWindow.ScrollRow = 37
ElseIf Cells(10, Target.Column) = 3 Then
Application.EnableEvents = False
Cells(38, Target.Column) = _
Application.WorksheetFunction.Sum(Range(Cells(13, Target.Column), Cells(20, Target.Column)))
If Cells(38, Target.Column) > Cells(9, Target.Column) Then _
Cells(38, Target.Column) = Cells(9, Target.Column)
Application.EnableEvents = True
ActiveWindow.ScrollRow = 38
End If
ErrorHandler:
'MsgBox "Error Nummer :" & Err.Number
End Sub