Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
900to904
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
900to904
900to904
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
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


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
.

307 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige