Code-Verkürzung
19.09.2021 13:04:47
Guesa
Da ab und an in der Datei Formeln zerschossen werden habe ich folgenden Code jetzt eingebaut. Funktioniert auch alles. Frage: Kann man das ganze auch kürzen, wenn ja wie. Schon mal Danke für Eure Hilfe
Gruß, Guesa
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Range("B4:B1300")) Is Nothing) Then
Application.ScreenUpdating = False
'Formel für Spalte C Zuordnung Standort/Abteilung
Worksheets("Sicherung Formeln").Cells(4, 3).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 3).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte Y Berechnung 1/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 25).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 25).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte Z Berechnung 2/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 26).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 26).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AA Berechnung 3/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 27).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 27).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AB Berechnung 4/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 28).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 28).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AC Berechnung 5/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 29).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 29).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AD Berechnung 6/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 30).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 30).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AE Berechnung 7/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 31).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 31).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AF Berechnung 8/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 32).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 32).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Application.EnableEvents = False
'Formel für Spalte AG Berechnung 9/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 33).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 33).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AH Berechnung 10/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 34).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 34).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Formel für Spalte AI Berechnung 10/ Tage für Meldung
Worksheets("Sicherung Formeln").Cells(4, 35).Copy
Worksheets("Daten").Cells(ActiveCell.Row, 35).PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Application.EnableEvents = False 'Steuerung aus
Worksheets("Daten").Cells(ActiveCell.Row, 3).Activate 'zurück nach Spalte C
Application.EnableEvents = True 'Steuerung wieder an
End If
End Sub