Textbox en formularios para que me acepte formato numero, moneda y fecha

Hola expertos, realize un formulario que con ayuda de ustedes me funciono muy bien ya lo tengo trabajando y funciona ala perfección, mi problemita es cuestión de estética ya que al ejecutar la ventana o formulario me manda alas columnas correspondientes formato texto y me pone el triangulito verde de error donde indica que es formato texto y no numero, fecha y moneda se ve muy mal mi hoja con indicaciones verdes por todos lados, según yo ya modifique el código para que me envíe el formato correspondiente correcto a mi hoja pero me sigue marcando los errores de formato creo que estoy haciendo algo mal, me gustaría me pudieran ayudar de ante mano les agradecería mucho.
<pre class="prettyprint" style="width: 555px; height: 993px;">Private Sub cmdAceptar_Click()
'Inicio de Validaciones
If Not IsNumeric(txtPedido.Text) And _
txtPedido.Text <> "" Then
Beep
MsgBox "Sólo números permitidos"
txtPedido.Text = ""
End If
txtPedido.SetFocus
If txtFactura = "" Then
MsgBox "Campo del Factura no puede estar Vacío", vbCritical, CAPTURA
txtFactura.SetFocus
Else
If txtFechafactura = "" Then
MsgBox "Campo del Fecha Factura no puede estar Vacío", vbCritical, CAPTURA
txtFechafactura.SetFocus
Else
If Not IsNumeric(txtCantidad.Text) And _
txtCantidad.Text <> "" Then
Beep
MsgBox "Sólo números permitidos"
txtCantidad.Text = ""
txtCantidad.SetFocus
Else
If txtCodigo = "" Then
MsgBox "Campo Código no debe estar Vacío", vbCritical, CAPTURA
txtCodigo.SetFocus
Else
If txtCosto = Format(txtCosto, "$##,#0.00") Then
MsgBox "Campo Costo no debe estar Vacío", vbCritical, CAPTURA
txtCosto.SetFocus
Else
If txtDescripcion = "" Then
MsgBox "Campo Descripción no debe estar Vacío", vbCritical, CAPTURA
txtDescripcion.SetFocus
Else
If txtFalla = "" Then
MsgBox "Campo Falla no debe estar Vacío", vbCritical, CAPTURA
txtFalla.SetFocus
Else
'Call Desproteger
'Registro de Datos
Fila = 11
NewRow = Fila + Application.WorksheetFunction.CountA(Range("A11:A33"))
With ThisWorkbook.Worksheets("CAPTURA")
.Cells(NewRow, 1).Value = txtPedido
.Cells(NewRow, 2).Value = txtFactura
.Cells(NewRow, 3).Value = txtFechafactura
.Cells(NewRow, 4).Value = txtCantidad
.Cells(NewRow, 5).Value = txtCodigo
.Cells(NewRow, 7).Value = txtCosto
.Cells(NewRow, 6).Value = txtDescripcion
.Cells(NewRow, 9).Value = txtFalla
.Cells(NewRow, 11).Value = Lblfecha
End With
GoTo fin
'
End If
End If
End If
End If
End If
End If
End If
'Call Proteger
Exit Sub
fin:
ThisWorkbook.Worksheets("CAPTURA").Activate
'Call Proteger
' limpiamos la captura para el siguiente registro
Me.txtPedido.Text = ""
Me.txtFactura.Text = ""
Me.txtFechafactura.Text = ""
Me.txtCantidad.Text = ""
Me.txtCodigo.Text = ""
Me.txtCosto.Text = ""
Me.txtDescripcion.Text = ""
Me.txtFalla.Text = ""
' ponemos el cursor en el primer campo de captura
Me.txtPedido.SetFocus
End Sub</pre>

1 Respuesta

Respuesta
1

Cambia esta línea
.Cells(NewRow, 3).Value = txtFechafactura
Por esta
.Cells(NewRow, 3).Value = Format(txtFechafactura, "dd/mm/yyyy")
Saludos. Dam

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas