0% found this document useful (0 votes)
23 views

Coding Modul

The document contains VBA code for an Excel application with various subroutines: 1) Subroutines for searching data based on criteria, retrieving matching data, and populating a list box. 2) Subroutines for opening forms, saving the workbook, exiting the application with a confirmation prompt, and printing a preview of a report. 3) Additional subroutines for selecting different sheets in the workbook and returning to the main sheet.

Uploaded by

Owoks Net
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Coding Modul

The document contains VBA code for an Excel application with various subroutines: 1) Subroutines for searching data based on criteria, retrieving matching data, and populating a list box. 2) Subroutines for opening forms, saving the workbook, exiting the application with a confirmation prompt, and printing a preview of a report. 3) Additional subroutines for selecting different sheets in the workbook and returning to the main sheet.

Uploaded by

Owoks Net
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

----------------------------------------------

CODING MODUL | EXCEL & VBA TUTORIAL


----------------------------------------------
Option Explicit

Sub BukaForm()
FORMBUKUKAS.Show
End Sub

Sub Pencarian()
If Sheet1.Range("d8").Value = "All" Then
Call cariberdasarkan
Else
Call Semuapencarian
End If
Call AmbilData
End Sub

Sub Semuapencarian()
On Error GoTo OK
Dim CariData As Object
Set CariData = Sheet2
CariData.Range("A5").CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:= _
Sheet3.Range("L4:N5"), Copytorange:=Sheet3.Range("A4:J4"), Unique:=False
Exit Sub
OK:
Call MsgBox("Data tidak ditemukan", vbInformation, "Cari Data")
End Sub

Sub cariberdasarkan()
On Error GoTo salah
Dim CariData As Object
Set CariData = Sheet2
CariData.Range("A5").CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:= _
Sheet3.Range("L4:M5"), Copytorange:=Sheet3.Range("A4:J4"), Unique:=False
Exit Sub
salah:
Call MsgBox("Data tidak ditemukan", vbInformation, "Cari Data")
End Sub

Sub AmbilData()
Dim DBLAPORAN As Long
Dim irow As Long
irow = Sheet3.Range("A" & Rows.Count).End(xlUp).Row
DBLAPORAN = Application.WorksheetFunction.CountA(Sheet3.Range("A5:A1000000"))
If DBLAPORAN = 0 Then
Sheet5.ListBox1.ListFillRange = ""
Else
Sheet5.ListBox1.ListFillRange = "HASIL!A5:J" & irow
End If
End Sub

Sub Simpan()
ThisWorkbook.Save
End Sub
Sub Keluar()
Select Case MsgBox("Anda akan keluar dari aplikasi" _
& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Keluar")
Case vbNo
Exit Sub
Case vbYes
End Select
ThisWorkbook.Save
ThisWorkbook.Close
End Sub

Sub LAporan()
Sheet1.Select
End Sub

Sub Cetak()
Select Case MsgBox("Anda akan mencetak laporan" _
& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Cetak")
Case vbNo
Exit Sub
Case vbYes
End Select
Sheet1.PrintPreview
End Sub
Sub Kembali()
Sheet5.Select
End Sub

You might also like