in dem nachstehenden Makro komme ich nicht weiter.
wie muss ich die Formel nach dem ELSE ändern um mit den Variablen (e,f,g,h) die Formel in die Zelle zu schreiben.
Danke schon mal im Voraus
Sub gewicht()
Dim datum As Date, wks As Worksheet
Dim z As Range, d As Range, e As Range, f As Range, g As Range, h As Range
Set wks = Worksheets("Eingabe")
With wks
.Unprotect BIOCON
Set z = wks.Range("E:E").Find(what:=Date - 1, lookat:=xlWhole, LookIn:=xlValues)
Set d = wks.Cells(8, 28)
datum = "01.01." & Year(Date)
If datum = Date Then
d.Activate
ActiveCell.FormulaR1C1 = "=SUMIF(R7C4:R9C25,R[3]C,R9C4:R9C25)"
Selection.AutoFill Destination:=e, Type:=xlFillDefault
d.Offset(4, 0).Activate
ActiveCell.FormulaR1C1 = "=SUMIF(R11C4:R13C25,R[3]C,R13C4:R13C25)"
Selection.AutoFill Destination:=e, Type:=xlFillDefault
Else
z.Offset(15, 23).Activate
Set f = ActiveCell
Set e = f.Offset(0, 19)
Set g = f.Offset(3, 19)
Set h = f.Offset(3, 0)
ActiveCell.FormulaR1C1 = "=SUMIF(e:g,R[3]C,h:g)"
GoTo c
End If
c:
Columns("AB:CN").Activate
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
.Protect BIOCON
z.Activate
ActiveCell.Offset(15, -1).Activate
End With
End Sub