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

Coding Form Tabel Jabatan

This document contains VBA code for a userform that manages a table of job position data. The code includes subroutines for adding, deleting, resetting, and updating records in the table. It retrieves the job position data from a sheet and allows the user to select records to view or modify details using another userform form.

Uploaded by

Muhammad Khatami
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)
15 views4 pages

Coding Form Tabel Jabatan

This document contains VBA code for a userform that manages a table of job position data. The code includes subroutines for adding, deleting, resetting, and updating records in the table. It retrieves the job position data from a sheet and allows the user to select records to view or modify details using another userform form.

Uploaded by

Muhammad Khatami
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

CODING FORM TABEL JABATAN

Option Explicit

Private Sub CMDADD_Click()

FORMJABATAN.Show

End Sub

Private Sub CMDDELETE_Click()

Application.ScreenUpdating = False

Dim HapusData As Object

Me.TabelData.Value = ""

If Me.TxtNomor.Value = "" Then

Call MsgBox("Pilih data pada tabel data", vbInformation, "Hapus Data")

Else

'Membuat pesan konfirmasi hapus data

Select Case MsgBox("Anda akan menghapus data" _

& vbCrLf & "Apakah anda yakin?" _

, vbYesNo Or vbQuestion Or vbDefaultButton1, "Hapus data")

Case vbNo

Exit Sub

Case vbYes

End Select

Sheet2.Select

Selection.EntireRow.Delete

Me.CMDADD.Enabled = True

Call AmbilJabatan

Me.TxtNomor.Value = ""

Call MsgBox("Data berhasil dihapus", vbInformation, "Hapus Data")

Sheet1.Select
End If

End Sub

Private Sub CMDRESET_Click()

Me.TabelData.Value = ""

Me.TxtNomor.Value = ""

End Sub

Private Sub CMDUPDATE_Click()

Application.ScreenUpdating = False

Dim SUMBERUBAH As String

Dim CELLAKTIF As String

On Error GoTo EXCELVBA

With FORMJABATAN

.TXTNamaJabatan.Value = Me.TabelData.Column(1)

.TXTGajiPokok.Value = Me.TabelData.Column(2)

.TXTTunjangan1.Value = Me.TabelData.Column(3)

.TXTTunjangan2.Value = Me.TabelData.Column(4)

.TXTTunjangan3.Value = Me.TabelData.Column(5)

.TXTTunjangan4.Value = Me.TabelData.Column(6)

.TXTTotalGaji.Value = Me.TabelData.Column(7)

.CMDSimpan.Caption = "Update"

FORMJABATAN.Show

End With

Sheet2.Select

SUMBERUBAH = Sheets("DATAJABATAN").Cells(Rows.Count, "A").End(xlUp).Row

Sheets("DATAJABATAN").Range("A5:A" & SUMBERUBAH).Find(What:=Me.TxtNomor.Value,


LookIn:=xlValues, LookAt:=xlWhole).Activate

CELLAKTIF = ActiveCell.Row
'Sheet1.Select

Exit Sub

EXCELVBA:

Call MsgBox("Harap klik 2x pada tabel data", vbInformation, "Data Pegawai")

End Sub

Private Sub TabelData_Click()

On Error GoTo EXCELVBA

Application.ScreenUpdating = False

Dim SUMBERUBAH, CELLAKTIF As Long

Me.TxtNomor.Value = Me.TabelData.Value

Sheet2.Select

SUMBERUBAH = Sheets("DATAJABATAN").Cells(Rows.Count, "A").End(xlUp).Row

Sheets("DATAJABATAN").Range("A5:A" & SUMBERUBAH).Find(What:=Me.TxtNomor.Value,


LookIn:=xlValues, LookAt:=xlWhole).Activate

CELLAKTIF = ActiveCell.Row

Sheet1.Select

Exit Sub

EXCELVBA:

Call MsgBox("Data pegawai error", vbInformation, "Data Pegawai")

End Sub

Private Sub UserForm_Initialize()

Me.BackColor = RGB(104, 82, 200)

Call AmbilJabatan

End Sub

Private Sub AmbilJabatan()

Dim DJabatan As Long

Dim irow As Long


irow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row

DJabatan = Application.WorksheetFunction.CountA(Sheet2.Range("A5:A90000"))

If DJabatan = 0 Then

Me.TabelData.RowSource = ""

Else

Me.TabelData.RowSource = "DATAJABATAN!A5:H" & irow

End If

End Sub

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy