الكود
Private Sub CommandButton1_Click()
Dim erow As Long
Worksheets("magdi").Activate
rrow = Worksheets("magdi").Cells(1, 1).CurrentRegion.Rows.Count + 1
Sheets(1).Activate
lrow = Range("a" & Rows.Count).End(xlUp).Row
Range("a" & lrow + 1).Value = TextBox1
Range("a" & lrow + 1).Offset(0, 0).Value = TextBox1.Value
Range("a" & lrow + 1).Offset(0, 1).Value = TextBox2.Value
Range("a" & lrow + 1).Offset(0, 2).Value = TextBox3.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
End Sub
Private Sub CommandButton2_Click()
Dim erow As Long
Worksheets("yonis").Activate
rrow = Worksheets("yonis").Cells(1, 1).CurrentRegion.Rows.Count + 1
Sheets(2).Activate
lrow = Range("a" & Rows.Count).End(xlUp).Row
Range("a" & lrow + 1).Value = TextBox1
Range("a" & lrow + 1).Offset(0, 0).Value = TextBox1.Value
Range("a" & lrow + 1).Offset(0, 1).Value = TextBox2.Value
Range("a" & lrow + 1).Offset(0, 2).Value = TextBox3.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub CommandButton4_Click()
Dim erow As Long
Worksheets("mahmoud").Activate
rrow = Worksheets("mahmoud").Cells(1, 1).CurrentRegion.Rows.Count + 1
Sheets(3).Activate
lrow = Range("a" & Rows.Count).End(xlUp).Row
Range("a" & lrow + 1).Value = TextBox1
Range("a" & lrow + 1).Offset(0, 0).Value = TextBox1.Value
Range("a" & lrow + 1).Offset(0, 1).Value = TextBox2.Value
Range("a" & lrow + 1).Offset(0, 2).Value = TextBox3.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
End Sub