Guten Tag,
ich bräuchte eure Hilfe bei folgendem Code. An sich funktioniert so wie ich das sehen kann alles, jedoch wird mir der Laufzeitfehler 1004 - Die Activate-Methode des Range-Objektes kann nicht ausgeführt werden angezeigt.
Da ich in VBA noch sehr neu bin und den Code nicht selbst geschrieben habe, da ich die Datei lediglich auffrischen soll, wäre es super wenn mir jemand helfen könnte.
Sub Ersetzen()
'
' Ersetzen Makro
'
'
Application.ScreenUpdating = False
'Application.DisplayAlerts = False
Dim j As Integer
For j = 5 To 778
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 8).Value = "" Then
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Formula = neueFormel
End If
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Formula = neueFormel
End If
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Formula = neueFormel
End If
ElseIf Worksheets("MTR_ab_Oktober_2017").Cells(j, 8).Value <> "" Then
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Formula = neueFormel
End If
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 15).Formula = neueFormel
End If
If Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).HasFormula = True Then
Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Activate
alteFormel = Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Formula
neueFormel = Replace(alteFormel, "+6.6", "+6.5")
Worksheets("MTR_ab_Oktober_2017").Cells(j, 13).Formula = neueFormel
End If
End If
Next
'Application.DisplayAlerts = True
End Sub
Die (erste) markierte Zeile ist:
Worksheets("MTR_ab_Oktober_2017").Cells(j, 14).Activate
Vielen Dank!
|