ههه صبري نفد فوجدة الحل
Private Sub TextBox1_Change()
Dim LR As Integer, R As Integer, T As Integer
ListBox1.Clear
With Sheets("Sheet1")
LR = .Cells(.Rows.Count, 2).End(xlUp).Row
For R = 2 To LR
If .Cells(R, 2) Like "*" & TextBox1.Text & "*" Then
ListBox1.AddItem
ListBox1.List(T, 0) = .Cells(R, 1)
ListBox1.List(T, 1) = .Cells(R, 2)
ListBox1.List(T, 2) = .Cells(R, 3)
ListBox1.List(T, 3) = .Cells(R, 4)
ListBox1.List(T, 4) = .Cells(R, 5)
T = T + 1
End If
Next
End With
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox6.Enabled = False
Me.TextBox4.SetFocus
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If ChrW(KeyAscii) Like "[!0-9]" Then KeyAscii = 0
End Sub
Private Sub TextBox5_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If ChrW(KeyAscii) Like "[!0-9]" Then KeyAscii = 0
End Sub
'ÍÏË ÇáÖÛØ Úáì ÒÑ ÇáÊÚÏíá
Private Sub CommandButton3_Click()
Dim i As Integer
If TextBox4.Value = vbNullString Then
TextBox4.Value = "0"
End If
If TextBox5.Value = vbNullString Then
TextBox5.Value = "0"
End If
LR = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LR
If Sheet1.Cells(i, 1).Value = Val(TextBox2) Then
Sheet1.Cells(i, 3).Value = Me.TextBox4.Value
Sheet1.Cells(i, 4).Value = Me.TextBox5.Value
Sheet1.Cells(i, 6) = Val(Me.TextBox4.Value) - Val(Me.TextBox5.Value)
Sheet1.Cells(i, 5) = Val(Sheet1.Cells(i, 5)) - Val(Sheet1.Cells(i, 6))
End If
Next
MsgBox " Ëã ÇáÊÚÏíá " & Me.TextBox3.Value, 524352, "ÊÚÏíá"
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox1.SetFocus
ListBox1.Clear
TextBox1_Change
End Sub
'ÍÇá ÊÍÏíÏ ÇÍÏ ÕÝæÝ ÇáíÓÊ ÈæßÓ ÈÇáÖÛØ ÚáíÉ
Private Sub ListBox1_Click()
'äÞá ÈíÇäÇÊ ÇáÕÝ ÇáãÍÏÏ Çáì ÇáÊßÓÊ ÈæßÓÓ
For i = 0 To ListBox1.ColumnCount - 1
Me.Controls("TextBox" & i + 2).Value = Me.ListBox1.Column(i)
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Next
End Sub
'ÍÏË ÇäØáÇÞ ÇáÝæÑã
'end
Private Sub CommandButton2_Click()
Dim answer As Integer
answer = MsgBox("åá ÃäÊ ãÊÃßÏ ãä ÇáÎÑæÌ", 524324, "ÎÑæÌ")
If answer = vbYes Then
End
Else
'do nothing
End If
End Sub
Private Sub UserForm_Activate()
TextBox1_Change
End Sub