Duplicidad de datos en vba
Publicado por Jesus Pool (6 intervenciones) el 13/08/2017 01:48:18
Hola buenas tardes, me pueden ayudar con la sig. linea de codigo lo que estoy buscando hacer es que quiero evitar que halla valores duplicados en mis registros para ser mas especificos no quiero que se permita guardar un codigo que ya este previamente añadido, la linea de codigo en mi boton guardar es esta ........pd. Gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Private Sub B_Guardar_Click()
For I = 1 To 1500
If Sheets("Productos").Cells(I + 6, 2).Text = "" Then
Sheets("Productos").Cells(I + 6, 2) = Text_Codigo.Text
Sheets("Productos").Cells(I + 6, 3) = C_Estatus.Text
Sheets("Productos").Cells(I + 6, 4) = Text_Denominaciondistintiva.Text
Sheets("Productos").Cells(I + 6, 5) = C_Laboratorio.Text
Sheets("Productos").Cells(I + 6, 6) = Text_RegistroSanitario.Text
Sheets("Productos").Cells(I + 6, 8) = C_Forma.Text
Sheets("Productos").Cells(I + 6, 9) = C_Administracion.Text
Sheets("Productos").Cells(I + 6, 10) = Text_Presentacion.Text
Sheets("Productos").Cells(I + 6, 11) = Text_Precio.Text
Sheets("Productos").Cells(I + 6, 13) = Text_cualitativa.Text
Sheets("Productos").Cells(I + 6, 14) = Text_Cuantitativa.Text
Sheets("Productos").Cells(I + 6, 15) = Text_Excipiente.Text
Sheets("Productos").Cells(I + 6, 17) = C_Temperatura.Text
Sheets("Productos").Cells(I + 6, 18) = C_Humedad.Text
Sheets("Productos").Cells(I + 6, 19) = C_Luz.Text
Sheets("Productos").Cells(I + 6, 21) = C_Clasificacion.Text
Sheets("Productos").Cells(I + 6, 23) = C_Controles.Text
Sheets("Productos").Cells(I + 6, 25) = C_Grupo.Text
Sheets("Productos").Cells(I + 6, 26) = C_Subgrupo.Text
Text_Codigo = Empty
C_Estatus = Empty
Text_Denominaciondistintiva = Empty
C_Laboratorio = Empty
Text_RegistroSanitario = Empty
C_Forma = Empty
C_Administracion = Empty
Text_Presentacion = Empty
Text_Precio = Empty
Text_cualitativa = Empty
Text_Cuantitativa = Empty
Text_Excipiente = Empty
C_Temperatura = Empty
C_Humedad = Empty
C_Luz = Empty
C_Clasificacion = Empty
C_Controles = Empty
C_Grupo = Empty
C_Subgrupo = Empty
Text_Codigo.SetFocus
Exit For
End If
Next
End Sub
Valora esta pregunta


0