Advertisement
YasserKhalil2019

T4130_Check Duplicate Entry Non-Existing In TextBox Change

Oct 14th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. https://excel-egy.com/forum/t4130
  2. ---------------------------------
  3.  
  4. Private Sub TextBox1_Change()
  5. Dim ws As Worksheet, x As Long
  6.  
  7. x = 0
  8.  
  9. For Each ws In ThisWorkbook.Worksheets
  10. If ws.Name <> "Accueil" Then
  11. x = x + Application.CountIf(ws.Columns(1), TextBox1.Value)
  12. End If
  13. Next ws
  14.  
  15. If x = 0 Or TextBox1.Value = "" Then
  16. Label19.Visible = True
  17. ElseIf x > 1 Then
  18. Label19.Visible = False
  19. MsgBox "Duplicate Entry", vbExclamation
  20. Else
  21. Label19.Visible = False
  22. End If
  23. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement