ab und zu habe ich hier schon einmal reingeschaut und mir wertvolle Tipps geholt. Nun komme ich nicht weiter (bin Laie und arbeite nach dem Try/Error-Prinzip ;-)) und benötige Hilfe.
Der VBA-Code (nicht lachen):
Private Sub CommandButton1_Click()
Sheets("Tanken").Select
z = Range("A1").End(xlDown).Row + 1
If z > 65000 Then z = 1
Cells(z, 1) = ComboBox1 'Kennzeichen
Cells(z, 2) = TextBox1 'Datum
Cells(z, 3) = ComboBox2 'Tankstelle
Cells(z, 5) = Replace(TextBox2, " ", "0.00") ' ltr Kraftstoff
Cells(z, 6) = Replace(TextBox3, " ", "0.00") 'preis kraftstoff
Cells(z, 7) = Replace(TextBox4, " ", "0.00") 'ltr Motoröl
Cells(z, 8) = Replace(TextBox5, " ", "0.00") 'preis motoröl
Cells(z, 9) = TextBox6 'sonstiges
Cells(z, 10) = Replace(TextBox7, " ", "0.00") 'preis sonstiges
Cells(z, 11) = TextBox8 'Bemerkungen
Range("l2:l37").Select 'Anzahl Liter Kraftstoff
Selection.NumberFormat = "#,##0.00"
Range("m2:m37").Select 'Preis Kraftstoff
Selection.NumberFormat = "#,##0.00 $"
Range("n2:n37").Select 'Anzahl Liter Motoröl
Selection.NumberFormat = "#,##0.00"
Range("o2:o37").Select 'Preis Motoröl
Selection.NumberFormat = "#,##0.00 $"
Range("p2:p37").Select 'sonstiges
Selection.NumberFormat = "#,##0.00 $"
Range("e38:e9999").Select
Selection.NumberFormat = "#,##0.00"
Range("f38:f9999").Select
Selection.NumberFormat = "#,##0.00 $"
Range("g38:g9999").Select
Selection.NumberFormat = "#,##0.00"
Range("h38:h9999").Select
Selection.NumberFormat = "#,##0.00 $"
Range("i38:i9999").Select
Selection.NumberFormat = "@"
Range("j38:j9999").Select
Selection.NumberFormat = "#,##0.00 $"
Range("A38:K9999").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Sheets("Start").Select
End Sub
Ich gebe Daten (Zahlen) über eine Userform in die entsprechenden Textboxen ein.Handelt es sich um ganze Zahlen, werden die als Zahlen in das Tabellenblatt übergeben.
Gebe ich Zahlen mit Komma ein (Bsp.: 26,23) werden diese als Text übergeben.
Ich benötige aber Zahlen, da ich noch damit weiter arbeiten muss.
Vielen Dank im Voraus und einen guten Rutsch!