Gruppe
UDF
Problem
Wie kann ich eine Formel wie =SUMME(A1:A3) in ihre Einzelelemente, also =SUMME(A1+A2+A3) aufschlüsseln?
StandardModule: basMain
Function FormelText(rng As Range) As String
Dim rngAct As Range
Dim sTxt As String, sPre As String
sTxt = rng.Formula
sPre = Left(sTxt, InStr(sTxt, "("))
Set rng = Range(Mid(sTxt, InStr(sTxt, "(") + 1, Len(sTxt) - InStr(sTxt, "(") - 1))
sTxt = ""
For Each rngAct In rng.Cells
sTxt = sTxt & rngAct.Address(False, False) & "+"
Next rngAct
FormelText = sPre & Left(sTxt, Len(sTxt) - 1) & ")"
End Function