Macro para que reconozca revise si existe
Desde Venezuela
TEngo esta macro que quiero que me revise si en columna B, existe el nombre escrito en TextBox (txtProd).
¿Si existe?
MsgBox ("Este nombre ya está registrado. Verifica ...."), vbInformation, "Existe"
Exit Sub 'sale sin guardarSi no existe que siga la macro
Private Sub cbtNueClien_Click()
On Error Resume Next
Dim fila As Integer
Set ws = ActiveSheet
If cboHojas.Value = "" Then
MsgBox "NO HA SELECCIONADO HOJA"
Exit Sub
Else
'Viene de la Function valida(wtext As MSForms.Control, num)
'Por.Dante Amor
If MINCaracter(txtCod, "Cod/Producto", 10) = False Then Exit Sub ''AQUI 10 DIGITOS MINIMO
'Evita nombre repetido en B, busca si ya existe
Set busco = ws.Range("B:B").Find(txtProd.Text, LookIn:=xlValues, lookat:=xlWhole)
If Not busco Is Nothing Then 'Si lo encuentra
MsgBox ("Este nombre ya está registrado. Verifica ...."), vbInformation, "Existe"
Exit Sub 'sale sin guardar
End If
''''
'Inserta datos de nuevo cliente
With ws
fila = .Range("A2:A25000").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 If
Buscar.Enabled = False
Call Limpar(Me)
End SubEsta macro no lo hace aunque ¿pareciera que si tiene algo para eso?
1 Respuesta
Respuesta de Dante Amor
2