Excel - buscar, verificar y crear nuevo registro

 
Vista:

buscar, verificar y crear nuevo registro

Publicado por MOISEs (7 intervenciones) el 28/06/2010 16:39:20
necesito insertar informacion desde un formulario, al hacer click sobre el boton insertar, busque y compare que no exista esta informacion, si existe me envie un mesaje: "EQUIPO YA REGISTRADO, VERIFIQUE EL NUMERO DE BIEN NACIONAL"
sino
inserte la siguiente fila con la informacion

este es el codigo

Private Sub CommandButton3_Click()
Dim rng As Range
Worksheets("PALO NEGRO").Select
Range("A10").Select
Selection.EntireRow.Insert
Set rng = Cells.Find(What:=TextBox5.Text, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False):

If rng = TextBox5.Text Then
MsgBox "EQUIPO YA REGISTRADO, VERIFIQUE EL NUMERO DE BIEN NACIONAL", _
vbInformation + vbOKOnly, "REGISTRO DE EQUIPOS"
Worksheets("PALO NEGRO").Rows(11).Delete

Else
TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox1 = ""
TextBox1.SetFocus

End If

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder