Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Coding Form Bayar SPP

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

CODING FORM BAYAR SPP

1. CODING USERFORM INITIALIZE


Me.txtName.Enabled = False
Me.txtGrade.Enabled = False
Me.txtTotal.Enabled = False
Me.txtTotalPay.Enabled = False
Me.txtCredit.Enabled = False

With cmbGrade1
.AddItem "Kelas 10"
.AddItem "Kelas 11"
.AddItem "Kelas 12"
End With

Sheet1.Shapes("Menu2").Fill.ForeColor.RGB = RGB(232, 103, 24)


'Perintah menetralkan warna tombol icon
Sheet1.Shapes("Menu1").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu3").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu4").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu5").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu6").Fill.ForeColor.RGB = RGB(50, 35, 81)
On Error Resume Next
Me.TABELBAYAR.RowSource = Sheet2.Range("TABELPEMBAYARAN").Address(EXTERNAL:=True)

2. CODING CARI SISWA BAYAR (GET)


On Error GoTo EXCELVBA
If Me.txtID.Value = "" Then
Call MsgBox("Masukkan Nomor NISN terlebih dahulu", vbInformation, "Cari Data")
Else
Set FindName = Sheet2.Range("A5:A10000").Find(WHAT:=Me.txtID.Value, LookIn:=xlValues)
Me.txtName.Value = FindName.Offset(0, 1).Value
Me.txtGrade.Value = FindName.Offset(0, 2).Value
Me.txtTotalPay.Value = FindName.Offset(0, 15).Value
Me.txtCredit.Value = FindName.Offset(0, 16).Value
Me.txtDate.Value = Date
Call FILLSPP
Call CARIPEMBAYARAN
Sheet4.Range("Q3:Q14").ClearContents ‘Membersihkan range pembayaran sebelumnya pada
sheet kwitansi
Me.txtTotal.Value = ""
Me.txtTotal.Value = Format(Me.txtTotal.Value, "Rp #,###")
Me.txtTotalPay.Value = Format(Me.txtTotalPay.Value, "Rp #,###")
Me.txtCredit.Value = Format(Me.txtCredit.Value, "Rp #,###")

End If
Exit Sub
EXCELVBA:
Call MsgBox("Maaf data NISN belum terdaftar atau NISN salah", vbInformation, "Cari Data")

3. CODING DOUBLE KLIK LISTBOX


On Error GoTo ERWIN
Me.txtID.Value = Me.TABELBAYAR.Value
Me.txtName.Value = Me.TABELBAYAR.Column(1)
Me.txtGrade.Value = Me.TABELBAYAR.Column(2)
Me.txtTotalPay.Value = Me.TABELBAYAR.Column(15)
Me.txtCredit.Value = Me.TABELBAYAR.Column(16)
Call FILLSPP
Call CARITOTALBAYAR
Call CARIPEMBAYARAN
Sheet4.Range("Q3:Q14").ClearContents ‘Membersihkan range pembayaran sebelumnya pada
sheet kwitansi
Me.txtDate.Value = Date
Me.txtTotal.Value = ""
Me.txtTotal.Value = Format(Me.txtTotal.Value, "Rp #,###")
Me.txtTotalPay.Value = Format(Me.txtTotalPay.Value, "Rp #,###")
Me.txtCredit.Value = Format(Me.txtCredit.Value, "Rp #,###")
Exit Sub
ERWIN:
Call MsgBox("Pilih data pada tabel data", vbInformation, "Pilih Data")

4. CODING FILL SPP


Private Sub FILLSPP()
On Error GoTo EXCELVBA
Set CARISPP = Sheet1.Range("L9:L11").Find(WHAT:=Me.txtGrade.Value, LookIn:=xlValues)
Me.JULI.Value = CARISPP.Offset(0, 1).Value
Me.AGUSTUS.Value = CARISPP.Offset(0, 1).Value
Me.SEPTEMBER.Value = CARISPP.Offset(0, 1).Value
Me.OKTOBER.Value = CARISPP.Offset(0, 1).Value
Me.NOVEMBER.Value = CARISPP.Offset(0, 1).Value
Me.DESEMBER.Value = CARISPP.Offset(0, 1).Value
Me.JANUARI.Value = CARISPP.Offset(0, 1).Value
Me.FEBRUARI.Value = CARISPP.Offset(0, 1).Value
Me.MARET.Value = CARISPP.Offset(0, 1).Value
Me.APRIL.Value = CARISPP.Offset(0, 1).Value
Me.MEI.Value = CARISPP.Offset(0, 1).Value
Me.JUNI.Value = CARISPP.Offset(0, 1).Value

Me.CJULI.Value = False
Me.CAGUSTUS.Value = False
Me.CSEPTEMBER.Value = False
Me.COKTOBER.Value = False
Me.CNOVEMBER.Value = False
Me.CDESEMBER.Value = False
Me.CJANUARI.Value = False
Me.CFEBRUARI.Value = False
Me.CMARET.Value = False
Me.CAPRIL.Value = False
Me.CMEI.Value = False
Me.CJUNI.Value = False

Exit Sub
EXCELVBA:
Call MsgBox("Maaf, data yang dicari tidak ditemukan", vbInformation, "Cari Data")
End Sub

5. CODING CARI TOTAL BAYAR


Private Sub CARITOTALBAYAR()
On Error Resume Next
Set CARISPP = Sheet2.Range("A5:A10000").Find(WHAT:=Me.txtID.Value, LookIn:=xlValues)
Me.txtTotalPay.Value = CARISPP.Offset(0, 15).Value
Me.txtCredit.Value = CARISPP.Offset(0, 16).Value
End Sub

6. CODING CARI PEMBAYARAN


Private Sub CARIPEMBAYARAN()
On Error GoTo ERWIN
Set CARIBAYAR = Sheet2.Range("A5:A100000").Find(WHAT:=Me.txtID.Value, LookIn:=xlValues)
If CARIBAYAR.Offset(0, 3).Value <> "" Then
Me.CJULI.Enabled = False
Me.CJULI.Value = True
Else
Me.CJULI.Enabled = True
Me.CJULI.Value = False
End If

If CARIBAYAR.Offset(0, 4).Value <> "" Then


Me.CAGUSTUS.Enabled = False
Me.CAGUSTUS.Value = True
Else
Me.CAGUSTUS.Enabled = True
Me.CAGUSTUS.Value = False
End If

If CARIBAYAR.Offset(0, 5).Value <> "" Then


Me.CSEPTEMBER.Enabled = False
Me.CSEPTEMBER.Value = True
Else
Me.CSEPTEMBER.Enabled = True
Me.CSEPTEMBER.Value = False
End If

If CARIBAYAR.Offset(0, 6).Value <> "" Then


Me.COKTOBER.Enabled = False
Me.COKTOBER.Value = True
Else
Me.COKTOBER.Enabled = True
Me.COKTOBER.Value = False
End If

If CARIBAYAR.Offset(0, 7).Value <> "" Then


Me.CNOVEMBER.Enabled = False
Me.CNOVEMBER.Value = True
Else
Me.CNOVEMBER.Enabled = True
Me.CNOVEMBER.Value = False
End If

If CARIBAYAR.Offset(0, 8).Value <> "" Then


Me.CDESEMBER.Enabled = False
Me.CDESEMBER.Value = True
Else
Me.CDESEMBER.Enabled = True
Me.CDESEMBER.Value = False
End If

If CARIBAYAR.Offset(0, 9).Value <> "" Then


Me.CJANUARI.Enabled = False
Me.CJANUARI.Value = True
Else
Me.CJANUARI.Enabled = True
Me.CJANUARI.Value = False
End If
If CARIBAYAR.Offset(0, 10).Value <> "" Then
Me.CFEBRUARI.Enabled = False
Me.CFEBRUARI.Value = True
Else
Me.CFEBRUARI.Enabled = True
Me.CFEBRUARI.Value = False
End If

If CARIBAYAR.Offset(0, 11).Value <> "" Then


Me.CMARET.Enabled = False
Me.CMARET.Value = True
Else
Me.CMARET.Enabled = True
Me.CMARET.Value = False
End If

If CARIBAYAR.Offset(0, 12).Value <> "" Then


Me.CAPRIL.Enabled = False
Me.CAPRIL.Value = True
Else
Me.CAPRIL.Enabled = True
Me.CAPRIL.Value = False
End If

If CARIBAYAR.Offset(0, 13).Value <> "" Then


Me.CMEI.Enabled = False
Me.CMEI.Value = True
Else
Me.CMEI.Enabled = True
Me.CMEI.Value = False
End If

If CARIBAYAR.Offset(0, 14).Value <> "" Then


Me.CJUNI.Enabled = False
Me.CJUNI.Value = True
Else
Me.CJUNI.Enabled = True
Me.CJUNI.Value = False
End If

Exit Sub
ERWIN:
Call MsgBox("Nama Siswa belum terdaftar", vbInformation, "Data Siswa")
End Sub
7. CODING CHECK BOX (JULI – JUNI)

Private Sub CJULI_Click()


On Error Resume Next
If Me.CJULI.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 + (IIf(Me.JULI.Value =
"", 0, Me.JULI.Value))
Sheet4.Range("Q3").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.JULI.Value = "", 0,
Me.JULI.Value))
Sheet4.Range("Q3").Value = False
End If
End Sub

Private Sub CAGUSTUS_Click()


On Error Resume Next
If Me.CAGUSTUS.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.AGUSTUS.Value = "", 0, Me.AGUSTUS.Value))
Sheet4.Range("Q4").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.AGUSTUS.Value =
"", 0, Me.AGUSTUS.Value))
Sheet4.Range("Q4").Value = False
End If
End Sub

Private Sub CSEPTEMBER_Click()


On Error Resume Next
If Me.CSEPTEMBER.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.SEPTEMBER.Value = "", 0, Me.SEPTEMBER.Value))
Sheet4.Range("Q5").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) -
(IIf(Me.SEPTEMBER.Value = "", 0, Me.SEPTEMBER.Value))
Sheet4.Range("Q5").Value = False
End If
End Sub
Private Sub COKTOBER_Click()
On Error Resume Next
If Me.COKTOBER.Value = True Then
Sheet4.Range("Q6").Value = True
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.OKTOBER.Value = "", 0, Me.OKTOBER.Value))
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.OKTOBER.Value =
"", 0, Me.OKTOBER.Value))
Sheet4.Range("Q6").Value = False
End If
End Sub

Private Sub CNOVEMBER_Click()


On Error Resume Next
If Me.CNOVEMBER.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.NOVEMBER.Value = "", 0, Me.NOVEMBER.Value))
Sheet4.Range("Q7").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.NOVEMBER.Value
= "", 0, Me.NOVEMBER.Value))
Sheet4.Range("Q7").Value = False
End If
End Sub

Private Sub CDESEMBER_Click()


On Error Resume Next
If Me.CDESEMBER.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.DESEMBER.Value = "", 0, Me.DESEMBER.Value))
Sheet4.Range("Q8").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.DESEMBER.Value
= "", 0, Me.DESEMBER.Value))
Sheet4.Range("Q8").Value = False
End If
End Sub

Private Sub CJANUARI_Click()


On Error Resume Next
If Me.CJANUARI.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.JANUARI.Value = "", 0, Me.JANUARI.Value))
Sheet4.Range("Q9").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.JANUARI.Value =
"", 0, Me.JANUARI.Value))
Sheet4.Range("Q9").Value = False
End If
End Sub

Private Sub CFEBRUARI_Click()


On Error Resume Next
If Me.CFEBRUARI.Value = True Then
Sheet4.Range("Q10").Value = True
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 +
(IIf(Me.FEBRUARI.Value = "", 0, Me.FEBRUARI.Value))
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.FEBRUARI.Value =
"", 0, Me.FEBRUARI.Value))
Sheet4.Range("Q10").Value = False
End If
End Sub

Private Sub CMARET_Click()


On Error Resume Next
If Me.CMARET.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 + (IIf(Me.MARET.Value
= "", 0, Me.MARET.Value))
Sheet4.Range("Q11").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.MARET.Value =
"", 0, Me.MARET.Value))
Sheet4.Range("Q11").Value = False
End If
End Sub

Private Sub CAPRIL_Click()


On Error Resume Next
If Me.CAPRIL.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 + (IIf(Me.APRIL.Value =
"", 0, Me.APRIL.Value))
Sheet4.Range("Q12").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.APRIL.Value = "",
0, Me.APRIL.Value))
Sheet4.Range("Q12").Value = False
End If

End Sub

Private Sub CMEI_Click()


On Error Resume Next
If Me.CMEI.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 + (IIf(Me.MEI.Value =
"", 0, Me.MEI.Value))
Sheet4.Range("Q13").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.MEI.Value = "", 0,
Me.MEI.Value))
Sheet4.Range("Q13").Value = False
End If
End Sub

Private Sub CJUNI_Click()


On Error Resume Next
If Me.CJUNI.Value = True Then
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) + 0 + (IIf(Me.JUNI.Value =
"", 0, Me.JUNI.Value))
Sheet4.Range("Q14").Value = True
Else
Me.txtTotal.Value = (IIf(Me.txtTotal.Value = "", 0, Me.txtTotal.Value)) - (IIf(Me.JUNI.Value = "",
0, Me.JUNI.Value))
Sheet4.Range("Q14").Value = False
End If
End Sub

8. CODING TOMBOL BAYAR SPP


Application.ScreenUpdating = False
Dim TRANSKRIP As Object
Set TRANSKRIP = Sheet3.Range("A1000000").End(xlUp)
Set BAYARSPP = Sheet2.Range("A2:A10000").Find(WHAT:=Me.txtID.Value, LookIn:=xlValues)
If Me.txtID.Value = "" _
Or Me.txtName.Value = "" _
Or Me.txtGrade.Value = "" _
Or Me.txtTotal.Value = "" Then
Call MsgBox("Harap isi data siswa dengan lengkap", vbInformation, "Data Siswa")
Exit Sub
Else
If Me.CJULI.Value = True Then
BAYARSPP.Offset(0, 3).Value = Me.JULI.Value
Else
BAYARSPP.Offset(0, 3).Value = ""
End If

If Me.CAGUSTUS.Value = True Then


BAYARSPP.Offset(0, 4).Value = Me.AGUSTUS.Value
Else
BAYARSPP.Offset(0, 4).Value = ""
End If

If Me.CSEPTEMBER.Value = True Then


BAYARSPP.Offset(0, 5).Value = Me.SEPTEMBER.Value
Else
BAYARSPP.Offset(0, 5).Value = ""
End If

If Me.COKTOBER.Value = True Then


BAYARSPP.Offset(0, 6).Value = Me.OKTOBER.Value
Else
BAYARSPP.Offset(0, 6).Value = ""

End If

If Me.CNOVEMBER.Value = True Then


BAYARSPP.Offset(0, 7).Value = Me.NOVEMBER.Value
Else
BAYARSPP.Offset(0, 7).Value = ""

End If

If Me.CDESEMBER.Value = True Then


BAYARSPP.Offset(0, 8).Value = Me.DESEMBER.Value
Else
BAYARSPP.Offset(0, 8).Value = ""

End If

If Me.CJANUARI.Value = True Then


BAYARSPP.Offset(0, 9).Value = Me.JANUARI.Value
Else
BAYARSPP.Offset(0, 9).Value = ""
End If

If Me.CFEBRUARI.Value = True Then


BAYARSPP.Offset(0, 10).Value = Me.FEBRUARI.Value
Else
BAYARSPP.Offset(0, 10).Value = ""

End If

If Me.CMARET.Value = True Then


BAYARSPP.Offset(0, 11).Value = Me.MARET.Value
Else
BAYARSPP.Offset(0, 11).Value = ""

End If

If Me.CAPRIL.Value = True Then


BAYARSPP.Offset(0, 12).Value = Me.APRIL.Value
Else
BAYARSPP.Offset(0, 12).Value = ""

End If

If Me.CMEI.Value = True Then


BAYARSPP.Offset(0, 13).Value = Me.MEI.Value
Else
BAYARSPP.Offset(0, 13).Value = ""

End If

If Me.CJUNI.Value = True Then


BAYARSPP.Offset(0, 14).Value = Me.JUNI.Value
Else
BAYARSPP.Offset(0, 14).Value = ""

End If
Call MsgBox("Pembayaran berhasil", vbInformation, "Data Siswa")

On Error Resume Next


Me.TABELBAYAR.RowSource = Sheet2.Range("TABELPEMBAYARAN").Address(EXTERNAL:=True)

Me.txtTotalPay.Value = BAYARSPP.Offset(0, 15).Value


Me.txtCredit.Value = BAYARSPP.Offset(0, 16).Value
Sheet3.Range("H8").Value = Sheet3.Range("H8") + 1
TRANSKRIP.Offset(1, 0).Value = "PMB-100" & Sheet3.Range("H8").Value
TRANSKRIP.Offset(1, 1).Value = Me.txtGrade.Value
TRANSKRIP.Offset(1, 2).Value = Me.txtName.Value
TRANSKRIP.Offset(1, 3).Value = Me.txtID.Value
TRANSKRIP.Offset(1, 4).Value = Me.txtTotal.Value
TRANSKRIP.Offset(1, 5).Value = Me.txtDate.Value
TRANSKRIP.Offset(1, 4).Value = CDec(TRANSKRIP.Offset(1, 4).Value)

Select Case MsgBox("Kwitansi Pembayaran akan dicetak" _


& vbCrLf & "Lanjutkan?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Cetak Kwitansi")
Case vbNo
Me.CJULI.Enabled = True
Me.CAGUSTUS.Enabled = True
Me.CSEPTEMBER.Enabled = True
Me.COKTOBER.Enabled = True
Me.CNOVEMBER.Enabled = True
Me.CDESEMBER.Enabled = True
Me.CDESEMBER.Value = False
Me.CJANUARI.Enabled = True
Me.CFEBRUARI.Enabled = True
Me.CMARET.Enabled = True
Me.CAPRIL.Enabled = True
Me.CMEI.Enabled = True
Me.CJUNI.Enabled = True

Me.CJULI.Value = False
Me.CAGUSTUS.Value = False
Me.CSEPTEMBER.Value = False
Me.COKTOBER.Value = False
Me.CNOVEMBER.Value = False
Me.CDESEMBER.Value = False
Me.CJANUARI.Value = False
Me.CFEBRUARI.Value = False
Me.CMARET.Value = False
Me.CAPRIL.Value = False
Me.CMEI.Value = False
Me.CJUNI.Value = False
Exit Sub
Case vbYes
End Select
Sheet4.Range("D7").Value = "PMB-100" & Sheet3.Range("H8").Value
Sheet4.Range("L7").Value = "KWI-100" & Sheet3.Range("H8").Value
Sheet4.Range("D9").Value = Me.txtName.Value
Sheet4.Range("D10").Value = Me.txtGrade.Value
Sheet4.Range("D11").Value = Me.txtID.Value
Sheet4.Range("D12").Value = Me.txtTotal.Value
Sheet4.Range("K9").Value = Me.txtTotalPay.Value
Sheet4.Range("K10").Value = Me.txtCredit.Value
Sheet4.PrintOut
Call MsgBox("Kwitansi telah dicetak", vbInformation, "Cetak Data")
Sheet4.Range("D7").Value = ""
Sheet4.Range("L7").Value = ""
Sheet4.Range("D9").Value = ""
Sheet4.Range("D10").Value = ""
Sheet4.Range("D11").Value = ""
Sheet4.Range("D12").Value = ""
Sheet4.Range("K9").Value = ""
Sheet4.Range("K10").Value = ""

Me.CJULI.Enabled = True
Me.CAGUSTUS.Enabled = True
Me.CSEPTEMBER.Enabled = True
Me.COKTOBER.Enabled = True
Me.CNOVEMBER.Enabled = True
Me.CDESEMBER.Enabled = True
Me.CDESEMBER.Value = False
Me.CJANUARI.Enabled = True
Me.CFEBRUARI.Enabled = True
Me.CMARET.Enabled = True
Me.CAPRIL.Enabled = True
Me.CMEI.Enabled = True
Me.CJUNI.Enabled = True

Me.CJULI.Value = False
Me.CAGUSTUS.Value = False
Me.CSEPTEMBER.Value = False
Me.COKTOBER.Value = False
Me.CNOVEMBER.Value = False
Me.CDESEMBER.Value = False
Me.CJANUARI.Value = False
Me.CFEBRUARI.Value = False
Me.CMARET.Value = False
Me.CAPRIL.Value = False
Me.CMEI.Value = False
Me.CJUNI.Value = False
Me.txtID.Value = ""
Me.txtName.Value = ""
Me.txtGrade.Value = ""
Me.txtTotal.Value = ""
Me.txtTotalPay.Value = ""
Me.txtCredit.Value = ""
Me.txtDate.Value = ""
End If

9. CODING HAPUS PEMBAYARAN


Set HAPUSBAYAR = Sheet2.Range("A5:A300000").Find(WHAT:=Me.txtID.Value,
LookIn:=xlValues)
If Me.txtName.Value = "" _
Or Me.txtID.Value = "" _
Or Me.txtGrade.Value = "" Then
Call MsgBox("Harap pilih data yang akan dihapus", vbInformation, "Hapus Pembayaran")
Else
Select Case MsgBox("Anda akan menghapus data" _
& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Hapus data")
Case vbNo
Exit Sub
Case vbYes
End Select
Me.CJULI.Value = False
HAPUSBAYAR.Offset(0, 3).Value = ""

Me.CAGUSTUS.Value = False
HAPUSBAYAR.Offset(0, 4).Value = ""

Me.CSEPTEMBER.Value = False
HAPUSBAYAR.Offset(0, 5).Value = ""

Me.COKTOBER.Value = False
HAPUSBAYAR.Offset(0, 6).Value = ""

Me.CNOVEMBER.Value = False
HAPUSBAYAR.Offset(0, 7).Value = ""

Me.CDESEMBER.Value = False
HAPUSBAYAR.Offset(0, 8).Value = ""

Me.CJANUARI.Value = False
HAPUSBAYAR.Offset(0, 9).Value = ""
Me.CFEBRUARI.Value = False
HAPUSBAYAR.Offset(0, 10).Value = ""

Me.CMARET.Value = False
HAPUSBAYAR.Offset(0, 11).Value = ""

Me.CAPRIL.Value = False
HAPUSBAYAR.Offset(0, 12).Value = ""

Me.CMEI.Value = False
HAPUSBAYAR.Offset(0, 13).Value = ""

Me.CJUNI.Value = False
HAPUSBAYAR.Offset(0, 14).Value = ""

Call MsgBox("Data telah dihapus", vbInformation, "Data Bayar")


Me.txtID.Value = ""
Me.txtName.Value = ""
Me.txtGrade.Value = ""
Me.txtTotal.Value = ""
Me.txtTotalPay.Value = ""
Me.txtCredit.Value = ""
End If

10. CODING TOMBOL RESET


Me.CJULI.Enabled = True
Me.CAGUSTUS.Enabled = True
Me.CSEPTEMBER.Enabled = True
Me.COKTOBER.Enabled = True
Me.CNOVEMBER.Enabled = True
Me.CDESEMBER.Enabled = True
Me.CDESEMBER.Value = False
Me.CJANUARI.Enabled = True
Me.CFEBRUARI.Enabled = True
Me.CMARET.Enabled = True
Me.CAPRIL.Enabled = True
Me.CMEI.Enabled = True
Me.CJUNI.Enabled = True

Me.CJULI.Value = False
Me.CAGUSTUS.Value = False
Me.CSEPTEMBER.Value = False
Me.COKTOBER.Value = False
Me.CNOVEMBER.Value = False
Me.CDESEMBER.Value = False
Me.CJANUARI.Value = False
Me.CFEBRUARI.Value = False
Me.CMARET.Value = False
Me.CAPRIL.Value = False
Me.CMEI.Value = False
Me.CJUNI.Value = False

Me.txtID.Value = ""
Me.txtName.Value = ""
Me.txtGrade.Value = ""
Me.txtTotal.Value = ""
Me.txtTotalPay.Value = ""
Me.txtCredit.Value = ""

On Error Resume Next


Me.TABELBAYAR.RowSource = Sheet2.Range("TABELPEMBAYARAN").Address(EXTERNAL:=True)

11. CODING TOMBOL CARI KELAS


On Error GoTo salah
Set FINDGRADE = Sheet2
FINDGRADE.Range("S5").Value = Me.cmbGrade1.Value
FINDGRADE.Range("A4").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheet2.Range("S4:S5"), CopyTorange:=Sheet2.Range("U4:AK4"), Unique:=False
Me.TABELBAYAR.RowSource = Sheet2.Range("HASILCARIBAYAR").Address(EXTERNAL:=True)
Exit Sub
salah:
Call MsgBox("Maaf, data yang dicari tidak ditemukan", vbInformation, "Cari Data")

12. CODING USERFORM QUERY CLOSE


Sheet1.Shapes("Menu1").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu2").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu3").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu4").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu5").Fill.ForeColor.RGB = RGB(50, 35, 81)
Sheet1.Shapes("Menu6").Fill.ForeColor.RGB = RGB(50, 35, 81)

You might also like