Private Sub ComboBox1_Change() On Error Resume Next Dim RNG As Range Set RNG = Range("MY_DATA") If ComboBox1 <> "ÃÎÊÑ ÇáÅÓã ãä ÇáÞÇÆãÉ" And Application.WorksheetFunction.CountIf(RNG, ComboBox1) = 0 Then MsgBox "!åÐå ÇáÞÇÆãÉ áÅÎÊíÇÑ ÇáÅÓã ÝÞØ .. ááÊÚÏíá íãßäß ÅÓÊÎÏÇã ãÑÈÚ ÇáäÕ ÇáÎÇÕ ÈÇáÅÓã", vbExclamation, "ÚÝÜæÇð" ComboBox1 = "ÃÎÊÑ ÇáÅÓã ãä ÇáÞÇÆãÉ" ComboBox1.DropDown Exit Sub End If TextBox1 = Application.WorksheetFunction.VLookup(ComboBox1, RNG, 1, 0) ComboBox2 = Application.WorksheetFunction.VLookup(ComboBox1, RNG, 2, 0) TextBox3 = Application.WorksheetFunction.VLookup(ComboBox1, RNG, 3, 0) TextBox4 = Application.WorksheetFunction.VLookup(ComboBox1, RNG, 4, 0) TextBox4 = Format(TextBox4, "dd/mm/yyyy") TextBox5 = Application.WorksheetFunction.VLookup(ComboBox1, RNG, 5, 0) TextBox5 = Format(TextBox5, "dd/mm/yyyy") End Sub Private Sub ADD_BTN_Click() Dim CONFIRM If TextBox1 = "" Or ComboBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Or TextBox5 = "" Then MsgBox "íÌÈ ÊÚÈÆÉ ßÇÝÉ ÇáÍÞæá", vbExclamation, "ÍÞæá ÛíÑ ããÊáÆÉ" Else CONFIRM = MsgBox(":áÞÏ ØáÈÊ ÊÓÌíá ÇáÈíÇäÇÊ ÇáÊÇáíÉ" & vbNewLine & "" & vbNewLine & "ÇáÅÓã: " & TextBox1 _ & vbNewLine & "" & vbNewLine & "äæÚ ÇáæËíÞÉ: " & ComboBox2 & vbNewLine & "" & vbNewLine & "ÑÞã ÇáæËíÞÉ: " & TextBox3 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÇáÅÕÏÇÑ: " & TextBox4 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÅäÊåÇÁ ÇáÕáÇÍíÉ: " & TextBox5 & vbNewLine & "" _ & vbNewLine & "Ýåá ÊæÏ ÇáÅÓÊãÑÇÑ¿", vbYesNo + vbQuestion, "ÊÃßíÏ ÇáÅÏÎÇá") If CONFIRM = vbYes Then With Columns(1).Rows(65536).End(xlUp) .Offset(1, 0) = TextBox1 .Offset(1, 1) = ComboBox2 .Offset(1, 2) = TextBox3 .Offset(1, 3) = TextBox4 .Offset(1, 4) = TextBox5 End With Me.Hide Sort MsgBox "ÊãÊ ÅÖÇÝÉ ÌãíÚ ÇáÈíÇäÇÊ ÈäÌÇÍ", vbInformation, "ÊãÊ ÇáÅÖÇÝÉ" End If End If End Sub Private Sub EDIT_BTN_Click() Dim RNG1 As Range Set RNG1 = Range("NAMES") If ComboBox1 = "ÃÎÊÑ ÇáÅÓã ãä ÇáÞÇÆãÉ" Then MsgBox "!íÌÈ ÅÎÊíÇÑ ÇáÅÓã ãä ÇáÞÇÆãÉ ÇáãäÓÏáÉ ÃæáÇð", vbExclamation, "ÅÎÊíÇÑ ÎÇØÆ" ComboBox1.DropDown ElseIf TextBox1 = "" Or ComboBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Or TextBox5 = "" Then MsgBox "!íÌÈ ÊÚÈÆÉ ßÇÝÉ ÇáÍÞæá ÃæáÇð", vbExclamation, "ÍÞæá ÛíÑ ããÊáÆÉ" Else Beep If MsgBox(":áÞÏ ØáÈÊ ÇáÊÚÏíá Åáì ÇáÈíÇäÇÊ ÇáÊÇáíÉ" & vbNewLine & "" & vbNewLine & "ÇáÅÓã: " & TextBox1 _ & vbNewLine & "" & vbNewLine & "äæÚ ÇáæËíÞÉ: " & ComboBox2 & vbNewLine & "" & vbNewLine & "ÑÞã ÇáæËíÞÉ: " & TextBox3 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÇáÅÕÏÇÑ: " & TextBox4 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÅäÊåÇÁ ÇáÕáÇÍíÉ: " & TextBox5 & vbNewLine & "" _ & vbNewLine & "Ýåá ÊæÏ ÇáÅÓÊãÑÇÑ¿", vbYesNo + vbQuestion, "ÊÃßíÏ ÇáÊÚÏíá") = vbYes Then A = Application.WorksheetFunction.Match(ComboBox1, RNG1, 0) Cells(A + 3, 5) = TextBox5 Cells(A + 3, 4) = TextBox4 Cells(A + 3, 3) = TextBox3 Cells(A + 3, 2) = ComboBox2.Text Cells(A + 3, 1) = TextBox1 Me.Hide Sort MsgBox "Êã ÊÚÏíá ÌãíÚ ÇáÈíÇäÇÊ ÈäÌÇÍ", vbInformation, "Êã ÇáÊÚÏíá" End If End If End Sub Private Sub DEL_BTN_Click() Application.ScreenUpdating = False Dim RNG1 As Range Set RNG1 = Range("NAMES") If ComboBox1 = "ÃÎÊÑ ÇáÅÓã ãä ÇáÞÇÆãÉ" Then MsgBox "!íÌÈ ÅÎÊíÇÑ ÇáÅÓã ãä ÇáÞÇÆãÉ ÇáãäÓÏáÉ ÃæáÇð", vbExclamation, "ÅÎÊíÇÑ ÎÇØÆ" ComboBox1.DropDown Else Beep If MsgBox(":áÞÏ ØáÈÊ ÍÐÝ ÇáÈíÇäÇÊ ÇáÊÇáíÉ" & vbNewLine & "" & vbNewLine & "ÇáÅÓã: " & TextBox1 _ & vbNewLine & "" & vbNewLine & "äæÚ ÇáæËíÞÉ: " & ComboBox2 & vbNewLine & "" & vbNewLine & "ÑÞã ÇáæËíÞÉ: " & TextBox3 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÇáÅÕÏÇÑ: " & TextBox4 & vbNewLine & "" & vbNewLine & "ÊÇÑíÎ ÅäÊåÇÁ ÇáÕáÇÍíÉ: " & TextBox5 & vbNewLine & "" _ & vbNewLine & "Ýåá ÊæÏ ÇáÅÓÊãÑÇÑ¿", vbYesNo + vbQuestion, "ÊÃßíÏ ÇáÍÐÝ") = vbYes Then A = Application.WorksheetFunction.Match(ComboBox1, RNG1, 0) Application.ScreenUpdating = False Me.Hide MsgBox " Êã ÍÐÝ ÇáÓÌá ÇáÎÇÕ È" & ComboBox1 & " ÈäÌÇÍ", vbInformation, "Êã ÇáÍÐÝ" Application.ScreenUpdating = False For C = 1 To 5 Cells(A + 3, C) = "" Next Sort End If End If Application.ScreenUpdating = True End Sub Private Sub CLEAR_BTN_Click() ComboBox1 = "ÃÎÊÑ ÇáÅÓã ãä ÇáÞÇÆãÉ" TextBox1 = "" ComboBox2 = "" TextBox3 = "" TextBox4 = "" TextBox5 = "" MsgBox "áÞÏ Êã ãÓÍ ãÍÊæíÇÊ ÌãíÚ ÇáÍÞæá ÈäÌÇÍ", vbInformation, "Êã ÇáãÓÍ" ComboBox1.SetFocus End Sub Private Sub END_BTN_Click() Unload Me End Sub Private Sub CommandButton6_Click() SEARCH_4_NAME.TextBox1.SetFocus SEARCH_4_NAME.Show End Sub Sub Add_Edit_Del_Record_initialize() RemoveDuplicates End Sub Private Sub UserForm_Click() End Sub