Private Sub CmdDel_Click()
[b2.b9,b11:b13].ClearContents
CmdSave.Enabled = False
CmdDel.Enabled = False
End Sub
Private Sub CmdSave_Click()
Dim Er As Single
With Sheets("DATA")
Er = .[b65000].End(xlUp)(2).Row
.Range("b" & Er).Resize(, 12) = WorksheetFunction.Transpose([b2.b13])
.Range("n" & Er) = Now
.Range("j" & Er) = IIf([b10] = 1, "Y", "N")
.Range("b4.b" & Er).Offset(, -1) = "=ROW()-3"
End With
CmdDel.Enabled = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Intersect(Target, [b2.b9,b11]) Is Nothing Or Target = "" Then Exit Sub
If Target = [b11] Then
If Len([b11]) <> 14 Then
MsgBox "Part# = 14", vbCritical
Target.ClearContents
Target.Select
ElseIf WorksheetFunction.CountA([b2.b9]) < [b2.b9].Count Then
MsgBox "Cot No con thieu DL"
[b2.b9].SpecialCells(4)(1).Select
End If
Else
If Not IsNumeric(Target) Or Target <= 0 Then
MsgBox "Ban tu ghi thong bao nhe"
Target.ClearContents
Target.Select
End If
End If
If WorksheetFunction.CountA([b2.b9,b11]) = [b2.b9,b11].Count Then
[b12] = "=AVERAGE(r2c2:r9c2)"
[b13] = "=STDEV(r2c2:r9c2)"
CmdSave.Enabled = True
End If
End Sub