Option Explicit
Sub cmdOK_Add_NV()
Const PNh As String = "Phieu Nhap": ReDim StrC(24) As String
Dim Rng As Range, Clls As Range: Dim Dem As Byte
Sheets("Add_NV").Select
Set Rng = Union([E10], [L10], Range("E11:E17"), [h17], [k17], [E18], [J18], Range("E19:E28"))
StrC(0) = "Nhap ho ten Tieng Viet"
StrC(1) = "Nhap Ma Nhan Vien"
StrC(2) = "Nhap ho ten Tieng Hoa"
StrC(3) = "Nhap ngay sinh"
StrC(4) = "Nhap dan toc"
StrC(5) = "Nhap noi sinh"
StrC(6) = "nhap nguyen quan"
StrC(7) = "nhap thuong tru"
StrC(8) = "nhap CMND"
StrC(9) = "Nhap ngay cap"
StrC(10) = "Nhap noi cap"
StrC(11) = "Nhap dien thoai"
StrC(12) = "Nhap DTDT "
StrC(13) = "Nhap Ngay Vao Lam"
StrC(14) = "Nhap ngay ky HDLD"
StrC(15) = "Nhap ngay het HDLD"
StrC(16) = "Nhap luong co ban"
StrC(17) = "Nhap p.c trach nhiem"
StrC(18) = "Nhap Tien chuyen can"
StrC(19) = "Chon phong ban"
StrC(20) = "Chon Noi Lam Viec"
StrC(21) = "Chon chuc vu"
StrC(22) = "Chon gioi tinh"
For Each Clls In Rng
If Clls.Value = "" Then
MsgBox StrC(Dem), , PNh: Exit Sub
End If
Dem = Dem + 1
Next Clls
With Sheets("DanhSach_NV").[A65500].End(xlUp).Offset(1)
.Value = .Offset(-1).Value + 1 'stt
1 .Offset(, 2).Value = Cells(10, 5).Value 'hoten viet
2 .Offset(, 3).Value = Cells(11, 5).Value 'hoten hoa
.Offset(, 1).Value = Cells(10, 12).Value 'manhanvien
.Offset(j, 4).Value = Cells(12, 5).Value 'ngaysinh
.Offset(j, 5).Value = Cells(28, 5).Value 'gioitinh
.Offset(j, 6).Value = Cells(25, 5).Value 'phongban
.Offset(j, 7).Value = Cells(27, 5).Value 'chucvu
.Offset(j, 8).Value = Cells(26, 5).Value 'noilamviec
.Offset(j, 9).Value = Cells(19, 5).Value 'ngayvao
3 .Offset(j, 10).Value = Cells(13, 5).Value 'dantoc
.Offset(j, 11).Value = Cells(14, 5).Value 'noisinh
.Offset(j, 12).Value = Cells(15, 5).Value 'nguyenquan
.Offset(j, 13).Value = Cells(16, 5).Value 'thuongtru
4 .Offset(j, 14).Value = Cells(17, 5).Value 'cmnd
.Offset(j, 15).Value = Cells(17, 8).Value 'ngaycap
.Offset(j, 16).Value = Cells(17, 11).Value 'noicap
.Offset(j, 22).Value = Cells(18, 5).Value 'dienthoai
.Offset(j, 23).Value = Cells(18, 10).Value 'dtdd
5 .Offset(j, 17).Value = Cells(20, 5).Value 'ngaykyhdld
.Offset(j, 18).Value = Cells(21, 5).Value 'ngayhethdld
.Offset(j, 19).Value = Cells(22, 5).Value 'luongcoban
6 .Offset(j, 20).Value = Cells(23, 5).Value 'pc.trachnhiem
.Offset(j, 22).Value = Cells(24, 5).Value 'chuyencan
End With
MsgBox "Added Successful!", vbOKOnly, "Add Employee"
Call cmdCancel_Add_NV
End Sub