Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender

Forumthread: Komma statt Punkt in Textbox

Komma statt Punkt in Textbox
03.09.2007 08:40:00
roger
Hallo, ich habe folgendes Problem: Es werden aus einer Tabelle (8Spalten) durch ein Commandbutton Werte in Textboxen geschrieben. Zahlen welche komma Stellen haben (punkt) werden in komma (komma) gewandelt (also 10.7 nach 10,7). Wie kann ich verhindern, dass dies geschieht? Wenn ich Werte manuell in die Textboxen schreibe, werden diese richtig mit punkt als Kommastelle eingeschrieben. Kann mir jemand helfen?
Option Explicit

Private Sub ComboBox1_Click()
If ComboBox1.ListIndex  0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 4)
TextBox2 = Cells(ComboBox1.ListIndex + 1, 5)
TextBox3 = Cells(ComboBox1.ListIndex + 1, 6)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 7)
TextBox5 = Cells(ComboBox1.ListIndex + 1, 8)
TextBox6 = Cells(ComboBox1.ListIndex + 1, 9)
TextBox7 = Cells(ComboBox1.ListIndex + 1, 10)
TextBox8 = Cells(ComboBox1.ListIndex + 1, 1)
Else
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
End If
End Sub



Private Sub CommandButton1_Click()
If ComboBox1.ListIndex > 0 Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
UserForm_Initialize
End If
End Sub



Private Sub CommandButton2_Click()
Dim xZeile As Long
If TextBox1 = "" Then Exit Sub
If ComboBox1.ListIndex = 0 Then
xZeile = [D65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
Cells(xZeile, 4) = CStr(TextBox1)
Cells(xZeile, 5) = CStr(TextBox2)
Cells(xZeile, 6) = CStr(TextBox3)
Cells(xZeile, 7) = CStr(TextBox4)
Cells(xZeile, 8) = CStr(TextBox5)
Cells(xZeile, 9) = CStr(TextBox6)
Cells(xZeile, 10) = CStr(TextBox7)
Cells(xZeile, 1) = CDate(TextBox8)
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
Columns("A:I").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub



Private Sub CommandButton3_Click()
Unload Me
End Sub



Private Sub TextBox1_Change()
End Sub



Private Sub TextBox8_Change()
End Sub



Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox1.Clear
aRow = [D65536].End(xlUp).Row
ComboBox1.AddItem "choose Date"
For i = 2 To aRow
ComboBox1.AddItem Cells(i, 1)
Next i
ComboBox1.ListIndex = 0
Application.EnableEvents = True
End Sub


Anzeige

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Komma statt Punkt in Textbox
03.09.2007 09:02:00
Chaos
Servus,
ich weiß zwar nicht, warum die Punkte in Kommas umgewandelt werden, aber du könntest das so auffangen:

Private Sub ComboBox1_Click()
If ComboBox1.ListIndex  0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 4)
TextBox1 = Replace(TextBox1.Value, ",", ".")
' u.s.w.
TextBox2 = Cells(ComboBox1.ListIndex + 1, 5)
TextBox3 = Cells(ComboBox1.ListIndex + 1, 6)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 7)
TextBox5 = Cells(ComboBox1.ListIndex + 1, 8)
TextBox6 = Cells(ComboBox1.ListIndex + 1, 9)
TextBox7 = Cells(ComboBox1.ListIndex + 1, 10)
TextBox8 = Cells(ComboBox1.ListIndex + 1, 1)
Else
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
End If
End Sub


Dann werden die Kommas durch Punkte ersetzt.
Gruß
Chaos

Anzeige
AW: Komma statt Punkt in Textbox
03.09.2007 09:18:00
roger
Super, das war es! Funktioniert super! Danke

AW: Bitteschön
03.09.2007 09:21:00
Chaos
.
;

Forumthreads zu verwandten Themen

Anzeige
Anzeige
Anzeige
Anzeige
Entdecke relevante Threads

Schau dir verwandte Threads basierend auf dem aktuellen Thema an

Alle relevanten Threads mit Inhaltsvorschau entdecken
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige