Edición de macro Excel para Nuevo ingreso
Te envío el libro del cual esta el otro tema también
Estas la macro para la validacion8 inserción) de nuevo producto
Private Sub cbtNueClien_Click()
On Error Resume Next
Dim fila As Integer
'Viene de la Function valida(wtext As MSForms.Control, num). Obliga insertar minimo 12 caracteres
'Por.Dante Amor
If MINCaracter(txtCod, "Cod/Producto", 10) = False Then Exit Sub ''AQUI 10 DIGITOS MINIMO
'If MINCaracter(txtFFact, "Fecha Factura", 10) = False Then Exit Sub 'AQUI 10 DIGITOS MINIMO
''''
'Inserta datos de nuevo cliente
With Sheets("Productos")
fila = .Range("A2:A50000").Find(txtCod, LookAt:=xlWhole).Row
If Err.Number = 91 Then
fila = .Range("b" & .Rows.Count).End(xlUp)(2).Row
Call ingresar_datos(fila)
Exit Sub
End If
Call ingresar_datos(fila)
End With
End Sub
'Inserta y luego ordena alfabeticamente de B hasta G tomando columna B
Sub ingresar_datos(fila As Integer, Optional OrdenarPor As String = "B") 'Ordena por la columna B
With Sheets("Productos")
.Cells(fila, 1) = txtCod
.Cells(fila, 2) = txtProd
.Cells(fila, 3) = txtProve
.Cells(fila, 4) = txtFactu
.Cells(fila, 5) = DTPicker1
.Cells(fila, 6) = CDbl(txtUbic.Value)
.Cells(fila, 7) = txtObser
.Range("A2:G" & fila).Sort key1:=.Range(OrdenarPor & fila) 'Ordena por la columna B
End With
'Limpiar controles
Dim tbx As Control
For Each tbx In Me.Controls
If TypeName(tbx) = "TextBox" Then tbx = ""
Next tbx
'carga ListBox
Call BuscaCambio
Call actualizar_lista
txtCod.SetFocus
End SubMacro a la cual quiero cambiar un TextBox por un DTPicker el cual debe Transferir la fecha que se vea 18-10-2016 en la celda respectiva de la hoja
1 respuesta
Respuesta de Dante Amor
1