السلام عليكم ورحمة الله وبركاته
اخي ياسر انا بدوي لا أدري أي كود بالضبط على ماظن وحد في هده الاكود
ارجو من الاخوة الكرام من يعريفه ان يشر اليه
Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Dim Rng As Range, LR As Long
Dim x, y, z
'x = InputBox("Please enter a Quantity")
UserForm2.Show
x = UserForm2.TextBox1.Value
y = UserForm2.TextBox2.Value
z = UserForm2.TextBox3.Value
Unload UserForm2
If x = False Or StrPtr(x) = 0 Or Not IsNumeric(x) Then
Exit Sub
Else
LR = Sheet1.Cells(Rows.Count, "E").End(xlUp).Row + 1
Set Rng = Sheet1.Cells(LR, 4)
If ListBox1.Value <> "" Then
Rng.Value = ListBox1.Value
Rng.Offset(0, 1).Value = y
Rng.Offset(0, 2).Value = x
Rng.Offset(0, 3).Value = ListBox1.List(ListBox1.ListIndex, 2)
Rng.Offset(0, 4).Value = z
End If
TextFind.SelStart = 0
TextFind.SelLength = Len(TextFind.Text)
TextFind.SetFocus
End If
End If
End Sub
Private Sub TextFind_Change()
Dim MyValue
Dim MyAr() As String
Dim R As Integer, i As Integer, ii As Integer
Dim MyColmnFind As Integer, Lastrow As Integer
MyColmnFind = Me.ComboBox1.ListIndex + 1
If MyColmnFind = 0 Then Exit Sub
If MyColmnFind = 3 Then Me.TextFind = ""
Me.ListBox1.Clear
With Rng.Worksheet
Lastrow = .Range("A65536").End(xlUp).Row
End With
Colmn = ""
With Rng
For R = 2 To Lastrow
If .Cells(R, MyColmnFind) Like "*" & TextFind & "*" Then
Colmn = Colmn & R & " "
ii = ii + 1
ReDim Preserve MyAr(1 To ContColmn, 1 To ii)
For i = 1 To ContColmn
MyValue = .Cells(R, i).Value2
MyAr(i, ii) = MyValue
Next
End If
Next
End With
If ii Then Me.ListBox1.Column = MyAr: Me.ListBox1.ListIndex = 0
End Sub