0% found this document useful (0 votes)
76 views5 pages

Excel VBA Code for Population Management

This document contains code modules for managing a population database. It includes subroutines for updating tables, sorting data, setting folder paths, locking and unlocking fields, searching for records, saving work, and opening forms. The code manages filtering, copying, and displaying results from a population data sheet.

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)
76 views5 pages

Excel VBA Code for Population Management

This document contains code modules for managing a population database. It includes subroutines for updating tables, sorting data, setting folder paths, locking and unlocking fields, searching for records, saving work, and opening forms. The code manages filtering, copying, and displaying results from a population data sheet.

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
You are on page 1/ 5

CODING MODUL SHEET MENU

Sub UpdateTabel()

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] = "DataPenduduk!A6:P" & iRow

End If

End If

[Link] = ""

[Link] = ""

End Sub

Sub UrutPenduduk()

[Link] = False

[Link]

[Link]("A5:P200000").Sort KEY1:=Range("A5"), Order1:=xlAscending, Header:=xlYes

[Link]

End Sub

Sub AturFolder()

Dim SelectedFolder As String

With [Link](msoFileDialogFolderPicker)

.Title = "Select Folder"

.ButtonName = "Confirm"

If .Show = -1 Then
SelectedFolder = .SelectedItems(1)

Call MsgBox(SelectedFolder)

[Link] = SelectedFolder & "\"

Else

End If

End With

End Sub

Sub AturKepalaDesa()

[Link]

[Link] = False

[Link] = False

[Link] = False

[Link] = False

[Link] = False

[Link] = False

'Surat Kelahiran

[Link]("F33").Value = [Link] & ", " & Format(Date, "DD MMMM


YYYY")

[Link]("F34").Value = "KEPALA DESA " & [Link]

[Link]("F39").Value = [Link]

'Surat Kematian

[Link]("F35").Value = [Link] & ", " & Format(Date, "DD MMMM


YYYY")

[Link]("F36").Value = "KEPALA DESA " & [Link]

[Link]("F41").Value = [Link]

'Surat Tidak Mampu


[Link]("F32").Value = [Link] & ", " & Format(Date, "DD MMMM
YYYY")

[Link]("F33").Value = "KEPALA DESA " & [Link]

[Link]("F38").Value = [Link]

'Surat KTP

[Link]("F30").Value = [Link] & ", " & Format(Date, "DD MMMM


YYYY")

[Link]("F31").Value = "KEPALA DESA " & [Link]

[Link]("F36").Value = [Link]

End Sub

Sub Unprotect()

[Link]

[Link] = True

[Link] = True

[Link] = True

[Link] = True

[Link] = True

[Link] = True

End Sub

Sub CariPenduduk()

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]("DataPenduduk")

Set sht = [Link]("CARIDATA")

Dim ish As Long

Dim isht As Long

Dim iColumn As Integer

ish = [Link]("DATAPENDUDUK").Range("A" &


[Link]).End(xlUp).Row

If [Link] = Empty Then

MsgBox "Silahkan masukkan kriteria pencarian"

Exit Sub

End If

iColumn = [Link]([Link], [Link]("A5:P5"),


0)

If [Link] = True Then

[Link] = False

End If

If [Link] = "Nomor KK" Then

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

Else

[Link]("A5:P" & 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] = "CARIDATA!A2:P" & isht

MsgBox "Data ditemukan"

Else

MsgBox "Data tidak ditemukan."

End If

[Link] = False

[Link] = True

End Sub

Sub SImpan()

[Link]

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

[Link]

[Link]

End Sub

Sub BukaFormPEnduduk()

[Link]

End Sub

Sub BukaSurat()

[Link]

End Sub

You might also like