AW: Formel einfügen per VBA
05.03.2015 11:31:57
Anton
Hallo,
Damit geht mir aber das AutoFill Destination bis zum /// "AF7:AF" & Letzte33 /// flöten, oder?
Die Formel soll Quasi ein mal nach unten, bis zum Zellenwert "Letzte33" gefüllt werden und ein mal nach Rechts bis zu AR.
Früher hab ich quasi folgendes Konstrukt verwendet, welches ich nun vereinfachen möchte:
Dim Letzte33 As Long
Dim jkk As Long
Dim jkkk As Long
jkk = 30
jkkk = 32
Letzte33 = ActiveSheet.Cells(1048576, jkk).End(xlUp).Row 'Hier zählt er die Zeilenanzahl
ActiveSheet.Cells(7, jkkk).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk).AutoFill Destination:=Range("AF7:AF" & Letzte33)
ActiveSheet.Cells(7, jkkk + 1).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 1).AutoFill Destination:=Range("AG7:AG" & Letzte33)
ActiveSheet.Cells(7, jkkk + 2).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 2).AutoFill Destination:=Range("AH7:AH" & Letzte33)
ActiveSheet.Cells(7, jkkk + 3).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 3).AutoFill Destination:=Range("AI7:AI" & Letzte33)
ActiveSheet.Cells(7, jkkk + 4).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 4).AutoFill Destination:=Range("AJ7:AJ" & Letzte33)
ActiveSheet.Cells(7, jkkk + 5).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 5).AutoFill Destination:=Range("AK7:AK" & Letzte33)
ActiveSheet.Cells(7, jkkk + 6).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 6).AutoFill Destination:=Range("AL7:AL" & Letzte33)
ActiveSheet.Cells(7, jkkk + 7).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 7).AutoFill Destination:=Range("AM7:AM" & Letzte33)
ActiveSheet.Cells(7, jkkk + 8).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 8).AutoFill Destination:=Range("AN7:AN" & Letzte33)
ActiveSheet.Cells(7, jkkk + 9).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 9).AutoFill Destination:=Range("AO7:AO" & Letzte33)
ActiveSheet.Cells(7, jkkk + 10).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 10).AutoFill Destination:=Range("AP7:AP" & Letzte33)
ActiveSheet.Cells(7, jkkk + 11).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 11).AutoFill Destination:=Range("AQ7:AQ" & Letzte33)
ActiveSheet.Cells(7, jkkk + 12).Formula = "=RC[-14]*RC[-28]"
ActiveSheet.Cells(7, jkkk + 12).AutoFill Destination:=Range("AR7:AR" & Letzte33)
Ich will quasi das einfügen der Formeln auf eine Schleife zusammenfassen, die die Spalten hochzählt.
MfG,
Anton Huber