0% found this document useful (0 votes)
5 views4 pages

Formulir Pencarian Data Surat

This document contains code for a search form to search and filter data from a worksheet. The code handles searching by different criteria, copying and filtering the results, and clearing or populating a results table.

Uploaded by

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

Formulir Pencarian Data Surat

This document contains code for a search form to search and filter data from a worksheet. The code handles searching by different criteria, copying and filtering the results, and clearing or populating a results table.

Uploaded by

NoorSodhiq
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CODING FORM DATA SURAT

Private Sub CMD_CARI_Click()

If [Link] = "" Then

MsgBox "Masukkan kriteria pencarian.", vbOKOnly + vbInformation, "Cari"

Exit Sub

End If

[Link] = False

Dim sh As Worksheet

Dim sht As Worksheet

Set sh = [Link]("DataSurat")

Set sht = [Link]("CARISURAT")

Dim ish As Long

Dim isht As Long

Dim iColumn As Integer

ish = [Link]("DataSurat").Range("A" & [Link]).End(xlUp).Row

If [Link] = Empty Then

Call MsgBox("Silahkan masukkan kriteria pencarian", vbInformation, "Masukkan Kriteria")

Exit Sub

End If

iColumn = [Link]([Link], [Link]("A5:G5"), 0)

If [Link] = True Then

[Link] = False

End If

If [Link] = "Nomor KK" Then


[Link]("A5:G" & ish).AutoFilter Field:=iColumn, Criteria1:=[Link]

Else

[Link]("A5:G" & ish).AutoFilter Field:=iColumn, Criteria1:="*" & [Link] & "*"

End If

[Link]

[Link] [Link]("A1")

[Link] = False

isht = [Link]("A" & [Link]).End(xlUp).Row

If isht > 1 Then

[Link] = "CARISURAT!A2:G" & isht

Call MsgBox("Data surat berhasil ditemukan", vbInformation, "Cari Surat")

Else

Call MsgBox("Data surat tidak ditemukan", vbInformation, "Cari Surat")

End If

[Link] = False

[Link] = True

End Sub

Private Sub CMD_OPEN_Click()

On Error GoTo EXCELVBA

[Link] ([Link](6))

Exit Sub

EXCELVBA:

Call MsgBox("Pilih data surat terlebih dahulu. Atau file surat tidak ditemukan", vbInformation, "File
Surat")

End Sub
Private Sub CMD_RESET_Click()

UserForm_Initialize

[Link] = ""

[Link] = ""

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()

[Link] = RGB(42, 45, 50)

Dim iRow As Long

If [Link]([Link]("A6:A100000")) = 0 Then

[Link] = ""

Else

iRow = [Link]("A" & [Link]).End(xlUp).Row

If iRow > 1 Then

[Link] = "DataSurat!A6:G" & iRow

End If

End If

[Link] = ""

[Link] = ""

With BERDASARKAN

.AddItem "Nama Penduduk"

.AddItem "NIK"

.AddItem "KK"

.AddItem "SURAT"

End With
End Sub

You might also like