No permitir valores duplicados en 2 columnas
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim ws As Worksheet, EvalRange As Range
Set EvalRange = Range("F1:G999")
If Intersect(Target, EvalRange) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) Then Exit Sub
If WorksheetFunction.CountIf(EvalRange, Target.Value) > 1 Then
MsgBox Target.Value & " already exists on this sheet."
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
For Each ws In Worksheets
With ws
If .Name <> Target.Parent.Name Then
If WorksheetFunction.CountIf(Sheets(.Name).Range("F1:G999"), Target.Value) > 0 Then
MsgBox Target.Value & " already exists on the sheet named " & .Name & ".", _
16, "No duplicates allowed in " & EvalRange.Address(0, 0) & "."
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Exit For
End If
End If
End With
Next ws
End SubBuena tarde estimados todos, solicito de su amable apoyo para terminar con la siguiente macro.
No permitir ingresar 2 números de parte idénticos en la misma orden de servicio anexo ejemplo
no he podido hacer que me funcione el código anexado.
sin mas por el momento quedo a sus ordenes.


2 respuestas
Respuesta de Dante Amor
2
Respuesta de Victor Rodriguez
1



