وعليكم السلام ورحمة الله وبركاته
تم بحمد الله التعديل على الكود
بحيث ياخذ البيانات من شيت1 دون الحاجة للدخول اليه
Private Sub ListBox1_Click()
For i = 0 To ListBox1.ListCount
If ListBox1.Selected(i) = True Then
For j = 1 To 26
Controls("TextBox" & j).Text = Sheets(1).Cells(ListBox1.List(i, 1), j)
Next j
End If
Next i
End Sub
Private Sub TextBox27_Change()
ListBox1.Clear
For i = 1 To 26
Controls("TextBox" & i).Text = ""
Next i
If TextBox27 = "" Then Exit Sub
' Sheets(1).Activate
ss = Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
k = 0
For Each C In Sheets(1).Range("B2:B" & ss)
If C Like TextBox27.Value & "*" Then
ListBox1.AddItem
ListBox1.List(k, 0) = Sheets(1).Cells(C.Row, 2).Value
ListBox1.List(k, 1) = C.Row
k = k + 1
End If
Next C
End Sub
Private Sub TextBox5_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox27.Value = ""
ListBox1.Clear
End Sub
Private Sub UserForm_Activate()
TextBox27.SetFocus
For i = 2 To Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
ListBox1.AddItem
ListBox1.List(i - 2, 0) = Sheets(1).Cells(i, 2).Value
ListBox1.List(i - 2, 1) = i
Next i
End Sub