Excel VBA Wenn Wert in Spalte A Werte und Formeln in weitere Spalten eintragen
Hallo zusammen,
Wenn in Spalte A "Ergebnis" steht, sollen wie unten beschrieben Formeln in die gleiche Zeile der danebenstehenden Spalten eingefügt werden.
Kann mir jemand verraten, was ich falsch mache?
Wäre für jeden Tipp dankbar!
Beste Grüße
Wenn in Spalte A "Ergebnis" steht, sollen wie unten beschrieben Formeln in die gleiche Zeile der danebenstehenden Spalten eingefügt werden.
Kann mir jemand verraten, was ich falsch mache?
Wäre für jeden Tipp dankbar!
Beste Grüße
Dim i As Long
Application.ScreenUpdating = False
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1) = "Ergebnis" _
Then Cells(Rows.Count, 2) = "=R[-1]C[1]" _
And Cells(Rows.Count, 4) = "=zählenwenn(C:C;B101)" _
And Cells(Rows.Count, 6) = "=summewenn(C$:C$;$B101;F:F)" _
And Cells(Rows.Count, 7) = "=F101/H101-1" _
And Cells(Rows.Count, 8) = "=summewenn(C$:C$;$B101;H:H)" _
And Cells(Rows.Count, 10) = "=summewenn(C$:C$;$B101;N:N)" _
And Cells(Rows.Count, 11) = "=N101/P101-1" _
And Cells(Rows.Count, 12) = "=summewenn(C$:C$;$B101;P:P)" _
Next i
Application.ScreenUpdating = True
Please also mark the comments that contributed to the solution of the article
Content-Key: 283491
Url: https://administrator.de/contentid/283491
Printed on: April 20, 2024 at 01:04 o'clock
3 Comments
Latest comment
Moin,
da stimmt leider so einiges nicht...
Gruß grexit
da stimmt leider so einiges nicht...
Dim i As Long
Application.ScreenUpdating = False
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1).Value = "Ergebnis" then
Cells(i, 2).FormulaLocal = "=R[-1]C[1]"
Cells(i, 4).FormulaLocal = "=zählenwenn(C:C;B101)"
Cells(i, 6).FormulaLocal = "=summewenn($C:$C;$B101;F:F)"
Cells(i, 7).FormulaLocal = "=F101/H101-1"
Cells(i, 8).FormulaLocal = "=summewenn($C:$C;$B101;H:H)"
Cells(i, 10).FormulaLocal = "=summewenn($C:$C;$B101;N:N)"
Cells(i, 11).FormulaLocal = "=N101/P101-1"
Cells(i, 12).FormulaLocal = "=summewenn($C:$C;$B101;P:P)"
End if
Next i
Application.ScreenUpdating = True
Gruß grexit
Wie kann ich das relativ machen?
Indem du die Formeln zusammenbaust, und die aktuelle Zeile mit einbaust.Beispiel:
Cells(i, 4).FormulaLocal = "=zählenwenn(C:C;B" & i & ")"