En Macro Excel ¿Cómo funcionaria esto?
En esta macro (tu conocida) ¿Cómo funcionaria este tipo de validación de los TextBox?
Private Sub cmbInsertar_Click()
'Por.Dante Amor http://www.todoexpertos.com/preguntas/6dfdswlh5iak7bjd/correccion-para-macro-excel-para-insertar-datos-mandando-error
'Obligar a llenar las cajas del 6 al 9
Dim vcs, vtx, i, LastRow, u
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="By Jot@"
''''''''''''''''
If CheckBox1 Then
vcs = Array("TextBox6", "Textbox7", "Textbox8", "Textbox9", "Textbox10", "Textbox11")
vtx = Array("UNA FECHA VALIDA", "EL NOMBRE DE EMPRESA", "REPESTOS PARA", "EL SERIAL MAQ/MOT", "LA MARCA", "EL MODELO/IDENT.")
For i = LBound(vcs) To UBound(vcs)
If Me.Controls(vcs(i)) = Empty Then
MsgBox "DEBES INTRODUCIR: " & vtx(i), vbExclamation, "LLENAR LISTA"
Exit Sub
End If
Next
''''''''''''''''
If CheckBox1.Value = False Then
'inserta datos empresa
vcs = Array("TextBox1", "Textbox2", "Textbox3", "Textbox4", "Textbox5")
vtx = Array("UN ITEM", "EL # DE PRODUCTO", "LA DESCRIPCION DEL PRODUCTO", "LA CANTIDAD", "EL # DE PAGINA")
For i = LBound(vcs) To UBound(vcs)
If Me.Controls(vcs(i)) = Empty Then
MsgBox "DEBES INTRODUCIR: " & vtx(i), vbExclamation, "LLENAR LISTA"
Exit Sub
End If
Next
'''''''''''''''''
'
Range("C8") = TextBox6 'Fecha
Range("E8") = TextBox7 'Nombre Empresa
Range("J8") = TextBox8 'Repuestos para
Range("D9") = TextBox9 'Serial Maq/Mot.
Range("G9") = TextBox10 'Marca
Range("K9") = TextBox11 'Modelo/Ident.
Range("D46").Value = Left(TextBox12.Value, 450) 'Notas
Else
'Productos
If CheckBox2 Then
'modifica producto
u = ComboBox1.ListIndex + 11
Else
'inserta producto
u = Range("b" & Rows.Count).End(xlUp).Row + 1
End If
Cells(u, "B") = TextBox1 'Item #
Cells(u, "C") = TextBox2 'Producto #
Cells(u, "D") = TextBox3 'Descripcion del Producto
Cells(u, "J") = Val(TextBox4) 'Cant.
Cells(u, "K") = TextBox5 'Pagina #
ComboBox1.Clear
For i = 11 To Range("B" & Rows.Count).End(xlUp).Row
ComboBox1.AddItem Cells(i, "D")
Next
End If
End If
ActiveSheet.Protect Password:="By Jot@"
Application.ScreenUpdating = True
Call Limpiar
ComboBox1 = ""
End SubLa posible validación que está entre '''''''''''''''''''
Quisiera usar ese tipo de advertencia porque menciona solo el cuadro indicado.
Trate con SOLO el 1º y me da pero ya incluyendo el 2º también, no me da
Además de esto.
1 respuesta
Respuesta de Dante Amor
2