Makro Ausführung
18.12.2020 15:25:39
Zulu
ich habe einen funktionierenden VBA Code. Leider läuft er nur wenn er sich auf das Tabellenblatt bezieht in welchem er steht. Könnt ihr mir ein Tipp geben wie ich ihm mitteile, dass er, wenn im bestehenden Blatt "Plan" der Bereich AP1:AW2 bearbeitet wird, das Makro im Blatt "Key" ausführen soll? Alles zwischen den gestrichelten Linien bezieht sich auf das Blatt "Key".
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Dim iCount As Integer
Set Target = Application.Intersect(Target, Range("AP1:AW2"))
If Target Is Nothing Then Exit Sub
On Error GoTo upsala
Application.EnableEvents = False
Worksheets("Key").Activate
For Each KeyCells In Target
Range("F52:F" & Range("F140").End(xlUp).Row).ClearContents
Cells(51, 4) = Range("D49") - Range("B49") + 1
Cells(52, 6) = Cells(49, 2)
For iCount = 0 To Cells(51, 4) - 1
Cells(52 + iCount, 6) = Cells(49, 2) + iCount
Cells(52 + iCount, 7) = "Winter BU"
Next
Next KeyCells
Application.EnableEvents = True
Exit Sub
upsala:
Application.EnableEvents = True
End Sub
Ich hoffe ich konnte darlegen was mein Prolem ist.
Danke für eure Unterstützung