Gruppe
Ereignis
Problem
Bei einer Eingabe in Spalte E soll die in der Parallelzelle in Spalte D hinterlegte Formel eingetragen werden.
ClassModule: Tabelle1
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strFormula As String
If Target.Column <> 5 Or IsEmpty(Target) Then Exit Sub
strFormula = Target.Offset(0, -1).Formula
strFormula = WorksheetFunction.Substitute(strFormula, ".", ",")
Application.EnableEvents = False
Target.Value = "'" & strFormula
Application.EnableEvents = True
End Sub
ClassModule: Tabelle2
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sFormula As String
If Target.Column <> 5 Or IsEmpty(Target) Then Exit Sub
sFormula = Target.Offset(0, -1).Value
sFormula = Application.Substitute(sFormula, ",", ".")
Application.EnableEvents = False
If Left(sFormula, 1) = "+" Then
Target.Value = "=" & sFormula
Else
Target.Value = sFormula
End If
Application.EnableEvents = True
End Sub