Problemas con TextBox comportamiento extraño
resulta que tengo un formulario parte de un proyecto y los textbox son dos programados para recibir solo uno para total y el otro para efectivo bueno al ingresar los números en los dos textbox normal pero al activar el botón registrar me marca el error que debería activar si se ingresaran letras explico al darle clic a registrar me dise error usted ingreso una letra aunque lo que haya ingresado sea numero enseguida agrego el código del formulario
Private Sub CommandButton1_Click() Application.ScreenUpdating = False Application.EnableCancelKey = xlDisabled If TextBox1 <> "" Then If TextBox2 <> "" Then por = Val(TextBox2.Text - TextBox1.Text) If por < 0 Then MsgBox "Faltan: " & Format(por, "$#,##.00") CommandButton1.SetFocus TextBox2 = "" TextBox2.SetFocus End If If por >= 0 Then MsgBox "Entregar Cambio de: " & Format(x, "$#,##.00") CommandButton1.SetFocus TextBox2 = "" TextBox2.SetFocus With Ventas Ventas.TextBox1 = Empty Ventas.TextBox2 = Empty Ventas.TextBox3 = Format(0, "$#,#.00") Ventas.ListBox1.Clear Cobrar.Hide Ventas.TextBox1.SetFocus Ventas.Label2 = 0 End With End If End If End If If TextBox1 = "" Then Cobrar.Hide MsgBox "No Hay Nada que Cobrar" End If Application.EnableCancelKey = xlInterrupt Application.ScreenUpdating = True End Sub Private Sub TextBox2_Change() aa = TextBox2.Text If TextBox2 <> "" Then If IsNumeric(aa) = False Then are1 = MsgBox("Error, digitó una letra. Por favor intente de nuevo. ", , ) TextBox2.SetFocus TextBox2 = Empty GoTo FIN Else enteroa = aa - Int(aa) End If End If FIN: End Sub Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) TextBox2 = Format(TextBox2, "$#,##.00") End Sub Private Sub UserForm_activate() TextBox2 = "" TextBox1 = Format(Ventas.TextBox3, "$#,#.00") TextBox2.SetFocus End Sub 'Evita Cerrar La Ventana Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then MsgBox "Use el botón CLOSE del formulario", vbInformation, " Botón No Disponible " Cancel = 1 CloseMode = 1 End If End Sub
espero respuesta si necesitan algo es de info me avisan de antemano muchas gracias