Jetzt muß ich hier Rat suchen. Ich habe 5 Dateien die unterschiedlich Anzahl von Sheets haben. Auf jedem sheet sind ca 1500 Formeln hinterlegt, die auf zwei weitere Datein zugreifen. Jetzt muß ich diese Formeln ändern. Hab den Code (siehe unten) soweit auch fertig, leider bekomm ich eine Fehlermeldung bei:
ZElle.Formula = str_FormulaNew
Woran liegt es denn?
Gruß
Dominic
Sub test()
Dim a As Long
Dim rng_a As Range
Dim ZElle As Object
Dim str_formulaOld As String
Dim str_FormulaNew As String
Dim str_formulaNew_Part1 As String
Application.Calculation = xlCalculationManual
For a = 1 To ActiveWorkbook.Worksheets.Count
Set rng_a = ActiveWorkbook.Worksheets(a).UsedRange
For Each ZElle In rng_a
If ZElle.HasFormula = True And Left(ZElle.Formula, 15) = "='Q:\SC\S C A\1" Then
str_formulaOld = ZElle.Formula
str_formulaNew_Part1 = Mid(str_formulaOld, 2, Application.WorksheetFunction.Find("-'Q", str_formulaOld, 1) - 2)
str_FormulaNew = "=wenn(abs((" & Mid(str_formulaOld, 2, Len(str_formulaOld)) & ")/" & str_formulaNew_Part1 & _
"))<0,1;"""";" & Mid(str_formulaOld, 2, Len(str_formulaOld)) & ")"
ZElle.Formula = str_FormulaNew
End If
Next
Next a
Set rng_a = Nothing
Application.Calculation = xlCalculationAutomatic
Application.Calculate
End Sub