السلام عليكم و رحمة الله
ضع الكودين الآتيين فى حدث الفورم
Private Sub CommandButton1_Click()
Dim ws As Worksheet, Knd As String
Dim x As Integer, Trgt As Range
Set ws = Sheets("ورقة1")
If Me.ComboBox1.Value = "" Or Me.TextBox1.Value = "" Then
MsgBox "يرجى استكمال البيانات"
Exit Sub
End If
Knd = Me.ComboBox1.Value
x = WorksheetFunction.Match(Knd, ws.Range("A1:F1"), 0)
Set Trgt = ws.Cells(2, x)
Trgt.Value = Trgt.Value + Me.TextBox1.Value
Me.ComboBox1.Value = ""
Me.TextBox1.Value = ""
End Sub
Private Sub UserForm_Initialize()
For Each c In Range("A1:F1")
Me.ComboBox1.AddItem c
Next
End Sub