Necesito restringir el ingreso de datos a la macro si los mismo ya fueron incluidos

Necesito restringir el ingreso de datos a la macro si los mismo ya fueron incluidos.

Tengo una macro y necesito que el a la hora de ingresar el dato me diga si ya esta incluido y que salga la leyenda "data duplicado".

Adjunto macro:

Sub DATOS()
'
' DATOS Macro
'

'
Sheets("DATOS").Select
Range("A1").Select
End Sub
Sub REGISTRO()
'
' REGISTRO Macro
'

'
Application.ScreenUpdating = False
Sheets("REGISTRO").Select
Range("C6").Select
End Sub
Sub GUARDAR()
'
' GUARDAR Macro
'

'
Application.ScreenUpdating = False
Sheets("DATOS").Select
Rows("6:6").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromRightOrBelow
Sheets("REGISTRO").Select
Range("C6:C11").Select
Selection.Copy
Sheets("DATOS").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("A6").Select
Sheets("REGISTRO").Select
Range("C6").Select
ActiveCell.FormulaR1C1 = ""
Range("C7").Select
ActiveCell.FormulaR1C1 = ""
Range("C8").Select
ActiveCell.FormulaR1C1 = ""
Range("C9").Select
ActiveCell.FormulaR1C1 = ""
Range("C10").Select
ActiveCell.FormulaR1C1 = ""
Range("C11").Select
ActiveCell.FormulaR1C1 = ""
Range("C6").Select
ActiveWorkbook.Save
Application.ScreenUpdating = True
End Sub

1 respuesta

Respuesta

Esto te puede ayudar adapta a la macro que ya tienes

https://m.youtube.com/watch?v=4XSrz4P0w9A 

https://m.youtube.com/watch?v=-ikuUoKlgcI 

Me da un error en tiempo de ejecución, no logro que me alerte si el dato esta duplicado.

Los ejemplos están chequeados, alguno de ellos te da error o tu macro, usa la parte de la macro del ejemplo y adáptala icorporando a la tuya,

O si prefieres usa find para encontrar el registro mira este otro ejemplo

https://youtu.be/8ofRt-SDpfc

https://youtu.be/SiYG7sBH7zo

https://youtu.be/wOudnnm8g-g

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas