tamnguoiban
Thành viên mới

- Tham gia
- 14/5/09
- Bài viết
- 4
- Được thích
- 0
em chưa hiểu lắm về đoạn code này. Nhờ các anh chị trong diễn đàn giải thích giúp em với.
Mong các anh chị chỉ giáo.Em cảm ơn nhiều
Private Sub NutGhi_Click()
Dim i As Long
'i = S1.Range("A650000").End(xlUp).Row
i = S1.Cells(Cells.Rows.Count, 1).End(3).Row
With S1
.Cells(i + 1, 1).Value = Me.XSogiay.Value
.Cells(i + 1, 2).Value = Me.XQuyenso.Value
.Cells(i + 1, 3).Value = Me.XHovaten.Text
.Cells(i + 1, 4).Value = Me.XGioitinh.Value
.Cells(i + 1, 5).Value = CDate(Me.XNgaysinh.Value)
.Cells(i + 1, 6).Value = Me.XGhibangchu.Text
.Cells(i + 1, 7).Value = Me.XNoisinh.Text
.Cells(i + 1, 8).Value = Me.XDantoc.Text
.Cells(i + 1, 9).Value = Me.XQuoctich.Text
.Cells(i + 1, 10).Value = Me.XHovatencha.Text
.Cells(i + 1, 11).Value = Me.XNamsinhcha.Value
.Cells(i + 1, 12).Value = Me.XDantoccha.Value
.Cells(i + 1, 13).Value = Me.XQuoctichcha.Value
.Cells(i + 1, 14).Value = Me.XThuongtrucha.Text
.Cells(i + 1, 15).Value = Me.XHovatenme.Text
.Cells(i + 1, 16).Value = Me.XNamsinhme.Value
.Cells(i + 1, 17).Value = Me.XDantocme.Value
.Cells(i + 1, 18).Value = Me.XQuoctichme.Value
.Cells(i + 1, 19).Value = Me.XThuongtrume.Text
.Cells(i + 1, 20).Value = Me.XNoidangky.Value
.Cells(i + 1, 21).Value = CDate(Me.XNgaydangky.Value)
.Cells(i + 1, 22).Value = Me.XGhichu.Text
.Cells(i + 1, 23).Value = Me.Xhovatennguoidikhai.Text
.Cells(i + 1, 24).Value = Me.XQuanhe.Text
.Cells(i + 1, 25).Value = Me.XHovatennguoithuchien.Text
.Cells(i + 1, 26).Value = Me.XHovatennguoiky.Text
.Cells(i + 1, 27).Value = Me.XChucvu.Text
Me.XSogiay.Value = ""
Me.XQuyenso.Value = ""
Me.XHovaten.Text = ""
Me.XGioitinh.Value = ""
Me.XNgaysinh.Value = ""
Me.XGhibangchu.Value = ""
Me.XNoisinh.Text = ""
Me.XDantoc.Text = ""
Me.XQuoctich.Text = ""
Me.XHovatencha.Text = ""
Me.XNamsinhcha.Text = ""
Me.XDantoccha.Value = ""
Me.XQuoctichcha.Value = ""
Me.XThuongtrucha.Text = ""
Me.XHovatenme.Text = ""
Me.XNamsinhme.Text = ""
Me.XDantocme.Value = ""
Me.XQuoctichme.Value = ""
Me.XThuongtrume.Text = ""
Me.XNoidangky.Value = ""
Me.XNgaydangky.Value = ""
Me.XGhichu.Text = ""
Me.Xhovatennguoidikhai.Text = ""
Me.XQuanhe.Text = ""
Me.XHovatennguoithuchien.Text = ""
Me.XHovatennguoiky.Text = ""
Me.XChucvu.Text = ""
Me.XSogiay.SetFocus
End With
End Sub
Mong các anh chị chỉ giáo.Em cảm ơn nhiều
Private Sub NutGhi_Click()
Dim i As Long
'i = S1.Range("A650000").End(xlUp).Row
i = S1.Cells(Cells.Rows.Count, 1).End(3).Row
With S1
.Cells(i + 1, 1).Value = Me.XSogiay.Value
.Cells(i + 1, 2).Value = Me.XQuyenso.Value
.Cells(i + 1, 3).Value = Me.XHovaten.Text
.Cells(i + 1, 4).Value = Me.XGioitinh.Value
.Cells(i + 1, 5).Value = CDate(Me.XNgaysinh.Value)
.Cells(i + 1, 6).Value = Me.XGhibangchu.Text
.Cells(i + 1, 7).Value = Me.XNoisinh.Text
.Cells(i + 1, 8).Value = Me.XDantoc.Text
.Cells(i + 1, 9).Value = Me.XQuoctich.Text
.Cells(i + 1, 10).Value = Me.XHovatencha.Text
.Cells(i + 1, 11).Value = Me.XNamsinhcha.Value
.Cells(i + 1, 12).Value = Me.XDantoccha.Value
.Cells(i + 1, 13).Value = Me.XQuoctichcha.Value
.Cells(i + 1, 14).Value = Me.XThuongtrucha.Text
.Cells(i + 1, 15).Value = Me.XHovatenme.Text
.Cells(i + 1, 16).Value = Me.XNamsinhme.Value
.Cells(i + 1, 17).Value = Me.XDantocme.Value
.Cells(i + 1, 18).Value = Me.XQuoctichme.Value
.Cells(i + 1, 19).Value = Me.XThuongtrume.Text
.Cells(i + 1, 20).Value = Me.XNoidangky.Value
.Cells(i + 1, 21).Value = CDate(Me.XNgaydangky.Value)
.Cells(i + 1, 22).Value = Me.XGhichu.Text
.Cells(i + 1, 23).Value = Me.Xhovatennguoidikhai.Text
.Cells(i + 1, 24).Value = Me.XQuanhe.Text
.Cells(i + 1, 25).Value = Me.XHovatennguoithuchien.Text
.Cells(i + 1, 26).Value = Me.XHovatennguoiky.Text
.Cells(i + 1, 27).Value = Me.XChucvu.Text
Me.XSogiay.Value = ""
Me.XQuyenso.Value = ""
Me.XHovaten.Text = ""
Me.XGioitinh.Value = ""
Me.XNgaysinh.Value = ""
Me.XGhibangchu.Value = ""
Me.XNoisinh.Text = ""
Me.XDantoc.Text = ""
Me.XQuoctich.Text = ""
Me.XHovatencha.Text = ""
Me.XNamsinhcha.Text = ""
Me.XDantoccha.Value = ""
Me.XQuoctichcha.Value = ""
Me.XThuongtrucha.Text = ""
Me.XHovatenme.Text = ""
Me.XNamsinhme.Text = ""
Me.XDantocme.Value = ""
Me.XQuoctichme.Value = ""
Me.XThuongtrume.Text = ""
Me.XNoidangky.Value = ""
Me.XNgaydangky.Value = ""
Me.XGhichu.Text = ""
Me.Xhovatennguoidikhai.Text = ""
Me.XQuanhe.Text = ""
Me.XHovatennguoithuchien.Text = ""
Me.XHovatennguoiky.Text = ""
Me.XChucvu.Text = ""
Me.XSogiay.SetFocus
End With
End Sub