Private Sub cbNhap_DL_Click()
Dim dong_cuoi As Long, ShName As String
ShName = ComboBox1.Text
If Len(ComboBox1.Text) = 0 Then MsgBox ("Chon ten sheet ghi du lieu"): Exit Sub
With Sheets(ShName)
dong_cuoi = .Range("E10000").End(xlUp).Row + 1
.Range("A" & dong_cuoi) = txtDate.Text
.Range("B" & dong_cuoi) = txtShift.Text
.Range("C" & dong_cuoi) = txtModel.Text
.Range("E" & dong_cuoi) = txtLotNo.Text
.Range("G" & dong_cuoi) = txtInput.Text
.Range("I" & dong_cuoi) = txtNG.Text
End With
Dim ctr As Control
For Each ctr In Me.Controls
If TypeName(ctr) = "TextBox" Then
txtLotNo.Text = ""
txtInput.Text = ""
txtNG.Text = ""
End If
Next ctr
txtLotNo.SetFocus
End Sub
Private Sub ComboBox1_Change()
If Len(ComboBox1.Text) = 0 Then MsgBox ("Chon ten sheet ghi du lieu"): Exit Sub
End Sub
Private Sub UserForm_Initialize()
Dim Arr As Variant, i As Long, k As Long
ReDim Arr(1 To Sheets.Count - 1)
For i = 1 To Sheets.Count
If Sheets(i).Name <> "NHAP" Then
k = k + 1
Arr(k) = Sheets(i).Name
End If
Next i
ComboBox1.List = Arr
ComboBox1.ListIndex = 0
End Sub