Anda di halaman 1dari 2

Dim aktif_sheet As Worksheet

Dim DatabaseMahasiswa As Object


Dim NoHP As String
Dim No_Urut As Integer
Set aktif_sheet = Worksheets("DatabaseMahasiswa")
If Me.Nama.Value = "" _
Or Me.Nim.Value = "" _
Or Me.Prodi.Value = "" _
Or Me.TanggalLahir.Value = "" _
Or Me.NoHP.Value = "" _
Or Me.Alamat.Value = "" Then
'Perintah memunculkan pesan jika ada data yang belum diisi
Call MsgBox("Maaf, Data input harus lengkap", vbInformation, "Input Data")
Nama.SetFocus
Else
Baris_Terakhir = aktif_sheet.Cells(Rows.Count - 1, 1).End(xlUp).Row + 1
No_Urut = aktif_sheet.Cells(Baris_Terakhir - 1, 1) + 1
aktif_sheet.Cells(Baris_Terakhir, 1) = No_Urut

aktif_sheet.Cells(Baris_Terakhir, 2) = Me.Nama.Value
aktif_sheet.Cells(Baris_Terakhir, 3) = Me.Nim.Value
aktif_sheet.Cells(Baris_Terakhir, 4) = Me.Prodi.Value
aktif_sheet.Cells(Baris_Terakhir, 6) = Me.TanggalLahir.Value
aktif_sheet.Cells(Baris_Terakhir, 7) = Me.NoHP.Text
aktif_sheet.Cells(Baris_Terakhir, 8) = Me.Usia.Value
aktif_sheet.Cells(Baris_Terakhir, 9) = Me.Alamat.Value

aktif_sheet.Cells(Baris_Terakhir, 10) = Me.PresAkademik.Value


aktif_sheet.Cells(Baris_Terakhir, 11) = Check1.Value
aktif_sheet.Cells(Baris_Terakhir, 12) = Check2.Value
aktif_sheet.Cells(Baris_Terakhir, 13) = Check3.Value
aktif_sheet.Cells(Baris_Terakhir, 14) = Check4.Value
aktif_sheet.Cells(Baris_Terakhir, 15) = Check5.Value

aktif_sheet.Cells(Baris_Terakhir, 16) = Me.PresNonAkademik.Value


aktif_sheet.Cells(Baris_Terakhir, 17) = Check6.Value
aktif_sheet.Cells(Baris_Terakhir, 18) = Check7.Value
aktif_sheet.Cells(Baris_Terakhir, 19) = Check8.Value
aktif_sheet.Cells(Baris_Terakhir, 20) = Check9.Value
aktif_sheet.Cells(Baris_Terakhir, 21) = Check10.Value
aktif_sheet.Cells(Baris_Terakhir, 22) = Check11.Value
aktif_sheet.Cells(Baris_Terakhir, 23) = Check12.Value

If Option1.Value = True Then


aktif_sheet.Range("E" & Baris_Terakhir).Value = Option1.Caption
Else
If Option2.Value = True Then
aktif_sheet.Range("E" & Baris_Terakhir).Value = Option2.Caption
End If
End If

aktif_sheet.Range("K" & Baris_Terakhir).Value = Check1.Value


aktif_sheet.Range("L" & Baris_Terakhir).Value = Check2.Value
aktif_sheet.Range("M" & Baris_Terakhir).Value = Check3.Value
aktif_sheet.Range("N" & Baris_Terakhir).Value = Check4.Value
aktif_sheet.Range("O" & Baris_Terakhir).Value = Check5.Value
aktif_sheet.Range("Q" & Baris_Terakhir).Value = Check6.Value
aktif_sheet.Range("R" & Baris_Terakhir).Value = Check7.Value
aktif_sheet.Range("S" & Baris_Terakhir).Value = Check8.Value
aktif_sheet.Range("T" & Baris_Terakhir).Value = Check9.Value
aktif_sheet.Range("U" & Baris_Terakhir).Value = Check10.Value
aktif_sheet.Range("V" & Baris_Terakhir).Value = Check11.Value
aktif_sheet.Range("W" & Baris_Terakhir).Value = Check12.Value

JumlahMahasiswa.Caption = Baris_Terakhir - 8
On Error Resume Next

Call MsgBox("Data berhasil ditambah", vbInformation, "Input Data")


Bersihkan
End If

Anda mungkin juga menyukai