Live-Forum - Die aktuellen Beiträge
Datum
Titel
29.03.2024 13:14:12
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1272to1276
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
Textbox in Userform als Wert
Ralph
Hallo Forum,
habe folgendes Problem:
In einer Userform habe ich mehrere Textboxen in die ich Zahlen eingebe. Ich möchte das wenn ich 1,7 eingebe 1,70 angezeigt wird.
Gruß Ralph

8
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Textbox in Userform als Wert
10.08.2012 08:13:48
hary
Hallo Ralph
Dann musst du das Format bestimmen.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Format(TextBox1, "0.00")
End Sub

gruss hary
AW: Textbox in Userform als Wert
10.08.2012 08:22:20
Ralph
Hallo Hary,
Das anzeigen klappt jetzt. Wenn ich jetzt die Zahlen in mein Tabellenblatt übertrage, kann ich damit nicht rechnen, weil sie als Text übernommen werden.
Was kann ich da machen?
Danke Ralph
AW: Textbox in Userform als Wert
10.08.2012 08:31:09
hary
Hallo
Textbox gibt nur Text zurueck.

Range("A1") = TextBox1 * 1 'Mal 1 nehmen

oder gleich:

Range("A3") = CDbl(TextBox1)

gruss hary
Anzeige
AW: Textbox in Userform als Wert
10.08.2012 08:39:01
Ralph
Hallo Hary,
Wo trage ich das ein? In den Code von der Textbox oder im Tabellenblatt?
Wenns im TB ist habe ich ein weiteres Problem, weil dort die Zellen jeden Tag gelöscht werden und in ein anders TB übertragen werden.
Gruß Ralph
AW: Textbox in Userform als Wert
10.08.2012 08:45:55
hary
Hallo Ralph
Ich weis ja nicht wie du den Inhalt uebertraegst.
Kannst du gleich mitmachen. Oder nimmst einen Button

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1 = Format(TextBox1, "0.00")
Range("A3") = CDbl(TextBox1)
End Sub

gruss hary
AW: Textbox in Userform als Wert
10.08.2012 09:00:42
Ralph
Hallo Hary,
hier mein Code zum übertragen von Userform auf TB.
Sub Umsatz_Buchen(TNr As Long)
'Dieses Makro dient der Eingabe der Buchung ueber eine Userform und schreibt die Eingabe in das  _
Blatt fuer den Tisch
Dim MySh As Worksheet
Dim TLastRow As Long
Application.ScreenUpdating = False
UF1.LB_Datum = Date
UF1.LB_Gast = ThisWorkbook.Sheets("Tischplan").Cells(TNr + 1, 2).Value
UF1.LB_Tisch = TNr
UF1.Show
If UserSel = "abbruch" Then
Unload UF1
Exit Sub
End If
'pruefen, ob Blatt fuer tisch schon vorhanden, ansonsten anlegen
UserSel = ""
For Each MySh In ThisWorkbook.Sheets
If MySh.Name = UF1.LB_Tisch.Caption Then
UserSel = "Blatt vorhanden"
Exit For
End If
Next MySh
If UserSel = "" Then
ThisWorkbook.Sheets("Tisch_Vorlage").Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets. _
Count)
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Name = UF1.LB_Tisch.Caption
ThisWorkbook.Sheets("" & UF1.LB_Tisch.Caption).Visible = True
End If
'Werte aus Userform uebernehmen
Set TargetSh = ThisWorkbook.Sheets("" & UF1.LB_Tisch.Caption)
With TargetSh
'finde letzte Zeile in Tischblatt
UserSel = ""
TLastRow = .Range(.Cells(.Rows.Count, 1).Address).End(xlUp).Row
If UF1.TB_Produkt1.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt1.Value
End If
If UF1.TB_Menge1.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge1.Value
End If
If UF1.TB_Preis1.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis1.Value
End If
If UF1.TB_Gesamt1.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt1.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt2.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt2.Value
End If
If UF1.TB_Menge2.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge2.Value
End If
If UF1.TB_Preis2.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis2.Value
End If
If UF1.TB_Gesamt2.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt2.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt3.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt3.Value
End If
If UF1.TB_Menge3.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge3.Value
End If
If UF1.TB_Preis3.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis3.Value
End If
If UF1.TB_Gesamt3.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt3.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt4.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt4.Value
End If
If UF1.TB_Menge4.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge4.Value
End If
If UF1.TB_Preis4.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis4.Value
End If
If UF1.TB_Gesamt4.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt4.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt5.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt5.Value
End If
If UF1.TB_Menge5.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge5.Value
End If
If UF1.TB_Preis5.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis5.Value
End If
If UF1.TB_Gesamt5.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt5.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt6.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt6.Value
End If
If UF1.TB_Menge6.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge6.Value
End If
If UF1.TB_Preis6.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis6.Value
End If
If UF1.TB_Gesamt6.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt6.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
If UF1.TB_Produkt7.Value  "" Then
UserSel = "zeile vorhanden"
.Cells(TLastRow + 1, 1).Value = UF1.TB_Produkt7.Value
End If
If UF1.TB_Menge7.Value  "" Then
.Cells(TLastRow + 1, 2).Value = UF1.TB_Menge7.Value
End If
If UF1.TB_Preis7.Value  "" Then
.Cells(TLastRow + 1, 3).Value = UF1.TB_Preis7.Value
End If
If UF1.TB_Gesamt7.Value  "" Then
.Cells(TLastRow + 1, 4).Value = UF1.TB_Gesamt7.Value
End If
If UserSel = "zeile vorhanden" Then
.Cells(TLastRow + 1, 5).Value = UF1.LB_Gast.Caption
.Cells(TLastRow + 1, 6).Value = UF1.LB_Datum.Caption
TLastRow = TLastRow + 1
UserSel = ""
End If
End With
ThisWorkbook.Sheets("Tische").Select
Application.ScreenUpdating = True
MsgBox "Umsatz fuer Tisch " & UF1.LB_Tisch.Caption & " gebucht.", 64, "Information"
'loesche userform
Unload UF1
End Sub

Gruß Ralph
Anzeige
AW: Textbox in Userform als Wert
10.08.2012 09:11:31
hary
Hallo
So wie ich es verstehe ist das die TextBox:UF1.TB_Preis1
dann so

If UF1.TB_Preis1.Value  "" Then
.Cells(TLastRow + 1, 3).Value = CDbl(UF1.TB_Preis1.Value)
End If

gruss hary
AW: Textbox in Userform als Wert
10.08.2012 09:51:35
Ralph
Hallo Hary,
tausend Dank, klappt einwandfrei.
Gruß Ralph

302 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige