هذة الاكواد لنموذج ادخال بيانات وتعديلها ارجو من حضراتكم حد يشرحها لى بالتفصيل وشكراً
Dim MyArray(22)
Private Sub ComboBox1_Change()
Dim R As Integer, RR As Integer, Endrow As Integer
If ComboBox1.Value = 0 Then GoTo 1
With Sheets("ÇáãåäÏÓíä")
Endrow = .Range("A" & .Rows.Count).End(xlUp).Row
For RR = 3 To Endrow
If .Cells(RR, 1).Value = ComboBox1.Value Then
For R = 1 To 21
Me.Controls(MyArray®).Value = .Cells(RR, R + 1).Value
Next R
Exit For
End If
Next RR
End With
1 End Sub
Private Sub ComboBox2_Change()
End Sub
Private Sub CommandButton21_Click()
Dim R As Integer, RR As Integer, N As Integer, Endrow As Integer
Application.ScreenUpdating = False
With Sheets("ÇáãåäÏÓíä")
Endrow = .Range("A" & .Rows.Count).End(xlUp).Row
For RR = 3 To Endrow
If .Cells(RR, 1).Value = ComboBox1.Value Then
For R = 1 To 21
.Cells(RR, R + 1).Value = Me.Controls(MyArray®).Value
Next R
Exit For
End If
Next RR
End With
MsgBox "Êã ÊÚÏíá ÇáÈíÇäÇÊ ÈäÌÇÍ", vbExclamation, "ÇáÍãÏááå"
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton22_Click()
End
End Sub
Private Sub CommandButton24_Click()
Application.ScreenUpdating = False
With Sheets("ÇáãåäÏÓíä")
Endrow = .Range("A" & .Rows.Count).End(xlUp).Row + 1
For R = 0 To 21
.Cells(Endrow, R + 1).Value = Me.Controls(MyArray®).Value
Next R
End With
MsgBox "ÊãÊ ÇÖÇÝÉ ÇáÈíÇäÇÊ ÈäÌÇÍ", vbExclamation, "ÇáÍãÏááå"
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton25_Click()
Private Sub UserForm_Activate()
Dim R As Integer
MyArray(0) = "ComboBox1"
For R = 1 To 21
MyArray® = "TextBox" & R
Next R
If Label4.Caption = "ÇÖÇÝÉ ãåäÏÓ Çæ ãæÙÝ ÌÏíÏ" Then KH_A Else KH_B
End Sub
Private Sub KH_A()
Me.ScrollTop = 0
With ComboBox1
.ShowDropButtonWhen = 0
.Style = 0
.SetFocus
End With
CommandButton21.Visible = False
End Sub
Private Sub KH_B()
Dim RR As Integer, Endrow As Integer
Me.ScrollTop = 0
CommandButton24.Visible = False
ComboBox1.Clear
With Sheets("ÇáãåäÏÓíä")
Endrow = .Range("A" & .Rows.Count).End(xlUp).Row
For RR = 3 To Endrow
ComboBox1.AddItem .Cells(RR, 1).Value
Next RR
End With
ComboBox1.SetFocus
End Sub