ich möchte gerne mit vorformatierten Steuerelementen rechnen.
Dabei ist mir aufgefallen, dass ich nicht einfach
Textbox2.Text = Textbox1.Text * ComboBox1.value rechnen kann, bzw. eine Fehlermeldung kommt.
Wie kann ich das Left(ComboBox1.Value, InStr(1, StrReverse(ComboBox1.Value), " ")) / 100 ändern.
Danke!
An alle Väter einen schönen Tag!
LG
Ludmila
Option Explicit
Const sE As String = "#,##0.00 " 'Format Euro
Const sM As String = "0" 'Format Menge
Const sP As String = "#0 %" 'Format Prozent
Const sD As String = "dd.mm.yyyy" 'Format Datum
Function FNC_ArrPE() 'Prozentwerte für cbo
FNC_ArrPE = Array("0 %", "5 % ", "10 %", "15 %", "20 %")
End Function
Private Sub CommandButton1_Click()
TextBox2.Text = CStr(CCur(TextBox1.Text)) * Left(ComboBox1.Value, InStr(1, StrReverse(ComboBox1.Value), " ")) / 100
Cells(2, 1) = CCur(TextBox1.Text)
Cells(2, 2) = ComboBox1.Value
Cells(2, 3) = CCur(TextBox2.Text)
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Text = Format(TextBox1.Text, sE)
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = FNC_ArrPE
ComboBox1.ListIndex = 1
TextBox1.Text = "10,00 "
End Sub
https://www.herber.de/bbs/user/146152.xlsm