Formeln per VBA in einfügen
10.04.2004 20:11:22
FaMue
Ich möchte in VBA eine Formel erzeugen und in eine Zelle eintragen.
Da Prinzip habe ich verstanden.es kommt aber eine Fehlermeldung.
Dim z2 'Zelle die ausgewertet wird
Dim z3 'Zelle i die die Formel soll
Dim f As String ' ist die Formel
z2 = "B1" ' dieser Wert wird in VBA erzeugt
z3 = "c4"
f = "=SVERWEIS(" & z2 & ";ARTIKEL!$A$2:$D$1030;VERGLEICH(" & Chr(34) & "Bezeichnung" & Chr(34) & ";ARTIKEL!$A$1:$D$1))"
f = WorksheetFunction.Substitute(f, ",", ".")
z3 = "$D$" & z1
MsgBox "zelle für Formel=:" & z3
Application.EnableEvents = False
Range(z3).Formula = f
Application.EnableEvents = True
Danke für Eure Hilfe