You are on page 1of 1

Private Sub CMDTMBH_Click()

Dim iRow As Long


Dim ws As Worksheet
Set ws = Worksheets("RAB")
'menemukan baris kosong pada database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
'check untuk sebuah kode
If Trim(Me.tno.Value) = "" Then
Me.tno.SetFocus
MsgBox "Masukan Kode Description"
Exit Sub
End If
'copy data ke database
ws.Cells(iRow, 1).Value = Me.tno.Value
ws.Cells(iRow, 2).Value = Me.tdescriptions.Value
ws.Cells(iRow, 3).Value = Me.ttotal.Value

'clear Data
Me.tno.Value = ""
Me.tdescriptions.Value = ""
Me.ttotal.Value = ""
Me.tno.SetFocus
End Sub

Private Sub CMDTTP_Click()


Unload Me
End Sub

You might also like