Gruppe
Funktion
Problem
In B2:B12 befinden sich die jeweiligen Auftragseingänge des Vorjahres, in C2:C10 die des aktuellen Jahres. Aufgrund der Monatsverteilung aus Spalte B soll für die restlichen Monate des laufenden Jahres (C11:C13) eine Prognose erstellt werden.
ClassModule: Tabelle3
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim intRow As Integer
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
If Target.Column = 2 Then
With Worksheets(Target.Offset(0, -1).Value)
intRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
.Cells(intRow, 4) = Target
.Cells(intRow, 3) = Target.Parent.Name
End With
ElseIf Target.Column = 4 Then
With Worksheets(Target.Offset(0, -1))
intRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(intRow, 2) = Target
.Cells(intRow, 1) = Target.Parent.Name
End With
End If
ERRORHANDLER:
Application.EnableEvents = True
End Sub
ClassModule: Tabelle1
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim iRow As Integer
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
If Target.Column = 2 Then
With Worksheets(Target.Offset(0, -1).Value)
iRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
.Cells(iRow, 4) = Target
.Cells(iRow, 3) = Target.Parent.Name
End With
ElseIf Target.Column = 4 Then
With Worksheets(Target.Offset(0, -1).Value)
iRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(iRow, 2) = Target
.Cells(iRow, 1) = Target.Parent.Name
End With
End If
ERRORHANDLER:
Application.EnableEvents = True
End Sub