AW: formatierung
24.01.2009 09:17:00
Tino
Hallo,
hier mal ein Code, kommt als Code in das entsprechende Tabellenblatt.
Den Wirkungsbereich musst Du noch anpassen.
Rechnen kannst Du aber nicht mehr damit.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim A As Long
Dim strZahl As String
Dim WirkungsBereich As Range
'hier den Wirkungsbereich angeben
Set WirkungsBereich = Range("A2:A50")
Application.EnableEvents = False
For A = 1 To Target.Count
If Not Intersect(Target(A), WirkungsBereich) Is Nothing Then
If Target(A) <> "" And IsNumeric(Target(A)) Then
strZahl = Format(Target(A), "#,##0.00")
strZahl = Replace(strZahl, ",", "@")
strZahl = Replace(strZahl, ".", ">")
strZahl = Replace(strZahl, "@", ".")
strZahl = Replace(strZahl, ">", ",")
Target(A) = "'" & strZahl
End If
End If
Next A
Application.EnableEvents = True
End Sub
Gruß Tino