Nguoiay
Thành viên hoạt động
- Tham gia
- 24/11/10
- Bài viết
- 139
- Được thích
- 34
Private Sub cLuu_Click()
Dim c As Long, text
text = Array("txtNgay", "txtSoPhieu", "txtMSKH", "txtTenKH", "txtDienGiai", "txtThu")
With ThisWorkbook.Worksheets("Database").Cells(Rows.Count, "A").End(xlUp).Offset(1)
For c = LBound(text) To UBound(text)
.Offset(0, c).Value = Me.Controls(text(c)).Value
Next c
End With
End Sub
Private Sub cLuu_Click()
Dim lastRow As Long
With ThisWorkbook.Worksheets("Database")
lastRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
.Range("A" & lastRow).Value = txtNgay.Value
.Range("B" & lastRow).Value = txtSoPhieu.Value
.Range("C" & lastRow).Value = txtMSKH.Value
.Range("D" & lastRow).Value = txtTenKH.Value
.Range("E" & lastRow).Value = txtDienGiai.Value
.Range("F" & lastRow).Value = txtThu.Value
End With
End Sub