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

Scrib 2

The document configures userform controls and defines macros to populate a list from a spreadsheet, display additional details on double click, add new entries, and close the form. Controls are configured and dropdowns populated. Data is written to the spreadsheet on input and fields are cleared.

Uploaded by

ASrul ABDmuin
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)
13 views4 pages

Scrib 2

The document configures userform controls and defines macros to populate a list from a spreadsheet, display additional details on double click, add new entries, and close the form. Controls are configured and dropdowns populated. Data is written to the spreadsheet on input and fields are cleared.

Uploaded by

ASrul ABDmuin
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/ 4

Sub RT2()

With UserForm2.ListBox3

.ColumnCount = 16

.ColumnHeads = True

.ColumnWidths = "25;100;150;100;25;100;60;60;70;100;100;90;90;100;100;70"

.RowSource = "A6:P1000"

.MultiSelect = fmMultiSelectSingle

.BoundColumn = 0

End With

End Sub

Private Sub ListBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

UserForm3.TNO2.Text = Me.ListBox3.Column(1)

UserForm3.TKK.Text = Me.ListBox3.Column(2)

UserForm3.Show

End Sub

Private Sub USERFORM_INITIALIZE()

Call UserForm2.RT2

With CMBKELAMIN

.AddItem "L"

.AddItem "P"

End With

With CMBAGAMA

.AddItem "ISLAM"

.AddItem "KRISTEN"

End With
With CMBKAWIN

.AddItem "KAWIN"

.AddItem "BELUM KAWIN"

.AddItem "PERNAH KAWIN"

End With

With CMBHUBUNGANKELUARGA

.AddItem "KEPALA KELUARGA"

.AddItem "ISTRI"

.AddItem "ANAK"

.AddItem "FAMILI LAIN"

End With

With CMBWARGANEGARA

.AddItem "INDONESIA"

.AddItem "ASING"

End With

End Sub

Private Sub CMDINPUT_Click()

Dim bariskosong As Long

Sheets("RT2").Activate

bariskosong = WorksheetFunction.CountA(Range("A:A")) + 4

'untuk mengecek nama

If Trim(Me.TNO1.Value) = "" Then

Me.TNO1.SetFocus

MsgBox "Data ini harus diisi dengan lengkap"

Exit Sub
End If

Cells(bariskosong, 1).Value = TNO1.Value

Cells(bariskosong, 2).Value = TKK.Value

Cells(bariskosong, 3).Value = TNAMA.Value

Cells(bariskosong, 4).Value = TNIK.Value

Cells(bariskosong, 5).Value = CMBKELAMIN.Value

Cells(bariskosong, 6).Value = TTEMPATLAHIR.Value

Cells(bariskosong, 7).Value = TTANGGALLAHIR.Value

Cells(bariskosong, 8).Value = CMBAGAMA.Value

Cells(bariskosong, 9).Value = TPENDIDIKAN.Value

Cells(bariskosong, 10).Value = TPEKERJAAN.Value

Cells(bariskosong, 11).Value = CMBKAWIN.Value

Cells(bariskosong, 12).Value = CMBHUBUNGANKELUARGA.Value

Cells(bariskosong, 13).Value = CMBWARGANEGARA.Value

Cells(bariskosong, 14).Value = TNAMAAYAH.Value

Cells(bariskosong, 15).Value = TNAMAIBU.Value

Cells(bariskosong, 16).Value = THP.Value

'MENGHAPUS DATA

Me.TNO1.Value = ""

Me.TKK.Value = ""

Me.TNAMA.Value = ""

Me.TNIK.Value = ""

Me.CMBKELAMIN.Value = ""

Me.TTEMPATLAHIR.Value = ""

Me.TTANGGALLAHIR.Value = ""
Me.CMBAGAMA.Value = ""

Me.TPENDIDIKAN.Value = ""

Me.TPEKERJAAN.Value = ""

Me.CMBKAWIN.Value = ""

Me.CMBHUBUNGANKELUARGA.Value = ""

Me.CMBWARGANEGARA.Value = ""

Me.TNAMAAYAH.Value = ""

Me.TNAMAIBU.Value = ""

Me.THP.Value = ""

Me.TNO1.SetFocus

End Sub

Private Sub CMDBATAL_Click()

Unload Me

End Sub

You might also like