Private Sub XYARN_BUY_CLEAR_Click()
intResponse = MsgBox("Chac an chua ?", vbYesNo + vbQuestion, "Are you OK?")
If intResponse = vbNo Then
Exit Sub
End If
Sheet4.[D2:D3] = "": Sheet4.[A6:G10].ClearContents
Sheet4.[D2].Active
End Sub
'-------------------------------------------------------
Private Sub XYARN_BUY_SAVE_Click()
Dim dong As Integer, Clls As Range, i
With Sheet4
dong = WorksheetFunction.Max(.[A6:A10])
[COLOR=seagreen]'Code kiem tra khong bo trong du lieu[/COLOR]
If .[D2] = "" Then
MsgBox "Tai o D2 chua co du lieu."
.[D2].Active: Exit Sub
End If
If .[D3] = "" Then
MsgBox "Tai o D3 chua co du lieu."
.[D3].Active: Exit Sub
End If
For Each Clls In .Cells(6, 1).Resize(dong, 6)
If Clls = "" Then
MsgBox "Tai o " & Clls.Address & " chua co du lieu."
Clls.Activate: Exit Sub
End If: Next
[COLOR=green]'Code Nhap vao Data[/COLOR]
Set Clls = Sheet2.[A65536].End(xlUp).Offset(1)
Clls.Resize(dong).Value = .[D3].Value
Clls.Offset(, 1).Resize(dong).Value = .[D2].Value
Clls.Offset(, 2).Resize(dong, 6).Value = .[B6].Resize(dong, 6).Value
[COLOR=green]'Code reset Form[/COLOR]
.[D2:D3] = "":: .[A6:G10].ClearContents
.[D2].Active
End With
End Sub