wie kann ich denn den KatVektor aktualisieren. Funktioniert nur wenn ich den Zellverbund aufhebe und in die Zellen klicke und mit Strg + Shift + Return abschließe.
Gruß,
Maris
Function meineFormel(Kategorie As String, _
Woche As Long, _
Hilfsspalte As String, _
Kennzahl As String) As Variant
Dim Ze As Long
Dim Sp As Long
Dim Zelle As Range
With Sheets(Kategorie)
Sp = .Rows(2).Find(what:=Woche, LookAt:=xlWhole).Column
Set Zelle = .Columns(1).Find(what:=Hilfsspalte, LookAt:=xlWhole)
Ze = .Columns(1).Find(what:=Kennzahl, after:=Zelle, LookAt:=xlWhole).Row
meineFormel = .Cells(Ze, Sp).Value
Application.Volatile
End With
End Function
Function meineFormel(Kategorie As String, ByVal Woche As Long, _
Hilfsspalte As String, Kennzahl As String, ByVal VorErg)
Dim Ze As Long, Sp As Long, Zelle As Range
With Sheets(Kategorie)
If IsEmpty(VorErg) Or VorErg = 0 Then
Sp = .Rows(2).Find(what:=Woche, LookAt:=xlWhole).Column
Set Zelle = .Columns(1).Find(what:=Hilfsspalte, LookAt:=xlWhole)
Ze = .Columns(1).Find(what:=Kennzahl, after:=Zelle, LookAt:=xlWhole).Row
meineFormel = .Cells(Ze, Sp).Value
Else: meineFormel = VorErg
End If
End With
End Function
Die ZellFml sähe dann bspw so aus: =meineFormel(B2;A2;D2;$E$1;$IV$1)