Professional Documents
Culture Documents
Koding CRUD Lisview
Koding CRUD Lisview
Koding CRUD Lisview
Sub NOMOROTOMATIS()
On Error Resume Next
Dim IdVal As Integer
IdVal = oto_LastRow(Sheets("DATA_SISWA"))
Me.TextBox1 = "NIK-521" & Format(IdVal, "0353000")
End Sub
Function oto_LastRow(ByVal Sht As Worksheet)
Dim lastRow As Long
Dim lRow As String
lastRow = Sht.Cells.SpecialCells(xlLastCell).Row
lRow = Sht.Cells.SpecialCells(xlLastCell).Row
Do While Application.CountA(Sht.Rows(lRow)) = 0 And lRow <> 1
lRow = lRow - 1
Loop
oto_LastRow = lRow
End Function
Sub Tampil()
Dim Item As ListItem
Dim ambildata As Integer
Dim i As Integer
ListView1.ListItems.Clear
ambildata = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To ambildata
Set Item = ListView1.ListItems.Add(Text:=Sheet2.Cells(i, 1))
Item.SubItems(1) = Sheet2.Cells(i, 2)
Item.SubItems(2) = Sheet2.Cells(i, 3)
Item.SubItems(3) = Sheet2.Cells(i, 4)
Item.SubItems(4) = Sheet2.Cells(i, 5)
Next
Label6.Caption = ListView1.ListItems.Count
End Sub
With Me.ListView1
.Gridlines = True
.HideColumnHeaders = False
.View = lvwReport
.FullRowSelect = True
End With
Call LoadListView
End Sub
Private Sub UserForm_Initialize()
Form1.Left = 1100
Form1.Height = 66
Call NOMOROTOMATIS
End Sub
Sub KONDISIAWAL()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
Call Tampil
Call NOMOROTOMATIS
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
TextBox1 = ListView1.SelectedItem
TextBox2 = ListView1.SelectedItem.SubItems(1)
TextBox3 = ListView1.SelectedItem.SubItems(2)
TextBox4 = ListView1.SelectedItem.SubItems(3)
TextBox5 = ListView1.SelectedItem.SubItems(4)
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Do While Form1.Height > 72
Form1.Height = Form1.Height - 1
DoEvents
Loop
Do While Form1.Left > -325
Form1.Left = Form1.Left - 1.5
DoEvents
Loop
Unload Me
End Sub