0% found this document useful (0 votes)
25 views3 pages

Syntax Tutorial 4

This document contains code for inputting, deleting, editing, and displaying data from a spreadsheet. The input section adds data from a text box to the next empty row. The delete section prompts the user for confirmation and deletes a matching data item. The edit section updates a selected row with text box data. The list box click subroutine displays the selected row text in the text box. The RefreshI subroutine populates the list box from the spreadsheet data.

Uploaded by

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

Syntax Tutorial 4

This document contains code for inputting, deleting, editing, and displaying data from a spreadsheet. The input section adds data from a text box to the next empty row. The delete section prompts the user for confirmation and deletes a matching data item. The edit section updates a selected row with text box data. The list box click subroutine displays the selected row text in the text box. The RefreshI subroutine populates the list box from the spreadsheet data.

Uploaded by

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

TUTORIAL 4: MULTIPAGE

INPUT DATA

On Error Resume Next


Dim masuk1
Sheets("SUMBER").Select
masuk1 = Sheets("SUMBER").[A60].End(3).Row + 1
Cells(masuk1, 1) = TextBox1.Value
TextBox1 = ""
RefreshI

HAPUS DATA

On Error Resume Next


Dim try1 As Integer
Dim cuba1 As Range
amaran1 = MsgBox("Anda ingin menghapuskan data ini. Anda pasti?", vbYesNo)
If amaran1 = vbNo Then Exit Sub
try1 = WorksheetFunction.CountA(Worksheets("SUMBER").Range("A:A"))
Set cuba1 = Worksheets("SUMBER").Range("A2:A60" & try1).Find(TextBox1.Value)
cuba1.Delete Shift:=xlUp

TextBox1 = ""
ListBox1.Clear

RefreshI

EDIT DATA

If TextBox1 = Empty Then


Call MsgBox("Klik data untuk dikemaskini", vbInformation, "KEMASKINI DATA KELAS")
Exit Sub
End If

cek1 = MsgBox("Anda pasti?", vbYesNo)


If cek1 = vbNo Then Exit Sub

UBAHBARIS1 = ListBox1.ListIndex + 2

Sheets("SUMBER").Range("A" & UBAHBARIS1).Value = TextBox1.Text '

Sheets("SUMBER").Select
Call MsgBox("Data telah dikemaskini", vbInformation, "KEMASKINI DATA KELAS")
LISTBOX CLICK

Private Sub ListBox1_Click()


LINENUMBER = ListBox1.ListIndex + 2
TextBox1.Text = Sheets("SUMBER").Range("A" & LINENUMBER).Value
End Sub

SUB RefreshI

Sub RefreshI()

For a = 2 To Sheets("SUMBER").[A60].End(3).Row
p=p+1
ListBox1.AddItem
ListBox1.List(p - 1, 0) = Sheets("SUMBER").Cells(a, 1)
Next
End Sub

You might also like