Sunteți pe pagina 1din 59

KODE FORM LOGIN

Private Sub UserForm_Initialize()

Form_Login.BackColor = RGB(0, 176, 240)

TxtUser.SetFocus

End Sub

Private Sub CmdLogin_Click()

Set Sh = Sheets("Pengaturan")

If TxtUser.Value = "" Then

MsgBox "Please Type User Name", vbExclamation + vbOKOnly, "Blank User Name"

TxtUser.SetFocus

Exit Sub

ElseIf TxtPswd.Value = "" Then

MsgBox "Please Type Password", vbExclamation + vbOKOnly, "Blank Password"

TxtPswd.SetFocus

Exit Sub

ElseIf TxtUser.Value <> Sh.Range("H86").Value Then

MsgBox "Invalid User Name", vbCritical + vbOKOnly, "Error User Name"

TxtUser.SetFocus

Exit Sub

ElseIf TxtPswd.Value <> Sh.Range("H88").Value Then

MsgBox "Wrong Password, please retype again", vbCritical + vbOKOnly, "Error Password"

TxtPswd.SetFocus
Exit Sub

End If

MsgBox "Congratulation " & Sh.Range("H9").Value & ", Login Success...!", vbInformation +
vbOKOnly, "Log in"

Unload Me

Sheet1.Activate

End Sub

Private Sub cmdCancel_Click()

ActiveWorkbook.Close (vbOKOnly)

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then

Cancel = True

MsgBox "Tombol X tidak diaktifkan, silahkan klik tombol Cancel untuk menutup aplikasi.",
vbCritical

End If

End Sub
KODE FORM NB

Dim BlnVal As Boolean

Private Sub UserForm_Initialize()

Dim IdVal As Integer

IdVal = fn_LastRow(Sheets("dtbaseNB"))

frmNB.txtId.Value = Sheet5.Range("A1").Value

frmNB.txtId.ForeColor = rgbBlack

frmNB.Caption = Sheet2.Range("D19").Value

frmNB.BackColor = RGB(0, 176, 240)

lbl_0.BackColor = RGB(0, 176, 240)

lbl_2.BackColor = RGB(0, 176, 240)

lbl_2.Caption = " " & Sheet2.Range("F23").Value

lbl_3.BackColor = RGB(0, 176, 240)

lbl_3.Caption = " " & Sheet2.Range("F25").Value

If Sheet2.Range("B21").Value = False Then

lbl_1.BackColor = RGB(0, 176, 240)

lbl_1.Caption = " " & Sheet2.Range("F21").Value

txt_1.Locked = False

ElseIf Sheet2.Range("B21").Value = True Then

lbl_1.Caption = " " & Sheet2.Range("F21").Value

lbl_1.BackColor = RGB(0, 176, 240)


txt_1.Value = "Auto"

txt_1.Locked = True

txt_1.BackColor = RGB(217, 217, 217)

txt_2.SetFocus

End If

If Sheet2.Range("B27").Value = True Then

lbl_4.Visible = True

txt_4.Visible = True

lbl_4.BackColor = RGB(0, 176, 240)

lbl_4.Caption = " " & Sheet2.Range("F27").Value

ElseIf Sheet2.Range("B27").Value = False Then

lbl_4.Visible = False

txt_4.Visible = False

End If

End Sub

Function fn_LastRow(ByVal Sht As Worksheet)

Dim lastrow As Long

Set Sht = Sheets("dtbaseNB")

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

fn_LastRow = lRow
End Function

Sub cmdAdd_Click()

BlnVal = 0

Call Data_Validation

If BlnVal = 0 Then Exit Sub

With Application

.ScreenUpdating = False

.EnableEvents = False

End With

Dim txtId, txt_1, cbx_3, txt_2, txt_4

Dim iCnt As Integer

iCnt = fn_LastRow(Sheets("dtbaseNB")) + 1

Application.Calculation = xlCalculationManual

With Sheets("dtbaseNB")

On Error Resume Next

.Cells(iCnt, 1) = frmNB.txtId.Value

.Cells(iCnt, 2) = frmNB.txt_1.Text

.Cells(iCnt, 3) = frmNB.txt_2.Text

.Cells(iCnt, 4) = frmNB.cbx_3.Text

.Cells(iCnt, 5) = frmNB.txt_4.Text

MsgBox Sheet2.Range("F23").Value & " berhasil ditambahkan...!", vbInformation,


Sheet2.Range("F23").Value
frmNB.cmdClear.SetFocus

End With

Dim IdVal As Integer

IdVal = fn_LastRow(Sheets("dtbaseNB"))

frmNB.txtId = Sheet5.Range("A1").Value

ErrOccured:

Application.ScreenUpdating = True

Application.EnableEvents = True

frmNB.txt_1.Value = ""

frmNB.txt_2.Value = ""

frmNB.cbx_3.Value = ""

frmNB.txt_4.Value = ""

frmNB.cmdCancel.SetFocus

Application.Calculation = xlCalculationAutomatic

End Sub

Sub Data_Validation()

Dim flag As Boolean

flag = True

If Not IsError(Application.Match(Me.txt_1, Sheets("dtbaseNB").Columns(2), 0)) Then

MsgBox Sheet2.Range("F21").Value & " sudah ada dalam data base, silahkan input Kode baru!",
vbInformation, Sheet2.Range("F21").Value
flag = False

Exit Sub

ElseIf Not IsError(Application.Match(Me.txt_2, Sheets("dtbaseNB").Columns(3), 0)) Then

MsgBox Sheet2.Range("F23").Value & " sudah ada dalam data base, silahkan input Nama baru!",
vbInformation, Sheet2.Range("F23").Value

flag = False

Exit Sub

ElseIf frmNB.cbx_3 = "" Then

MsgBox Sheet2.Range("F25").Value & " belum dipilih!", vbInformation, Sheet2.Range("F25").Value

Exit Sub

Else

BlnVal = 1

End If

End Sub

Private Sub cmdCancel_Click()

Unload Me

End Sub

Private Sub cmdClear_Click()

Application.ScreenUpdating = False

frmNB.txt_1.Value = ""

frmNB.txt_2.Value = ""

frmNB.cbx_3.Value = ""

frmNB.txt_4.Value = ""

Application.ScreenUpdating = True

Application.Calculation = xlAutomatic

End Sub
Private Sub ComboBox1_Change()

ListBox1.Value = ComboBox1.Value

End Sub

Private Sub cmdDel_Click()

Dim baris As Integer

Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

baris = IndexListbox + 1

With Sheets("dtbaseNB")

lDel = MsgBox("Anda yakin akan menghapus data nomor " & ListBox1.Value & "?", vbCritical +
vbYesNo, "Hapus Data")

If lDel = vbYes Then

With Sheets("dtbaseNB")

With .Cells(baris, "A")

Application.DisplayAlerts = False

.EntireRow.Delete

Application.DisplayAlerts = True

MsgBox "Data berhasil dihapus...!"

End With

End With
Else

MsgBox "Hapus data dibatalkan...!"

End If

Application.Calculation = xlCalculationAutomatic

End With

End If

End Sub

Private Sub cmdEdit_Click()

ComboBox2.Visible = True

ComboBox2.SetFocus

ComboBox1.Visible = True

ComboBox1.Enabled = False

ComboBox2.BackColor = rgbYellow

cmdSaveE.Visible = True

cmdSaveE.Enabled = True

cmdDel.Visible = True

cmdDel.Enabled = True

txtId.Visible = False

cmdAdd.Visible = False

cmdClear.Enabled = False

End Sub

Private Sub cmdSaveE_Click()

Dim iCnt As Integer


Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

iCnt = IndexListbox + 1

Application.Calculation = xlCalculationManual

With Sheets("dtbaseNB")

On Error Resume Next

.Cells(iCnt, 2) = frmNB.txt_1.Text

.Cells(iCnt, 3) = frmNB.txt_2.Text

.Cells(iCnt, 4) = frmNB.cbx_3.Text

.Cells(iCnt, 5) = frmNB.txt_4.Text

MsgBox "Data Berhasil diEdit!", vbInformation, "Edit Data"

End With

End If

cmdCancel.SetFocus

Application.Calculation = xlCalculationManual

frmNB.txt_1.Value = ""

frmNB.txt_2.Value = ""

frmNB.cbx_3.Value = ""

frmNB.txt_4.Value = ""

cmdDel.Enabled = False

cmdAdd.Enabled = False
cmdSaveE.Enabled = False

Application.Calculation = xlAutomatic

End Sub

Private Sub ListBox1_Click()

Application.Calculation = xlCalculationManual

Application.ScreenUpdating = False

txtId.Value = ListBox1.List(ListBox1.ListIndex, 0)

txt_1.Text = ListBox1.List(ListBox1.ListIndex, 1)

txt_2.Text = ListBox1.List(ListBox1.ListIndex, 2)

cbx_3.Text = ListBox1.List(ListBox1.ListIndex, 3)

txt_4.Text = ListBox1.List(ListBox1.ListIndex, 4)

Application.ScreenUpdating = True

Application.Calculation = xlAutomatic

End Sub

Private Sub ComboBox2_Change()

Application.Calculation = xlCalculationManual

Application.ScreenUpdating = False

ComboBox2.Visible = True

ComboBox2.BackColor = rgbYellow

ComboBox1.Value = ComboBox2.ListIndex

cmdSaveE.Visible = True

cmdDel.Visible = True

txtId.Visible = False
cmdAdd.Visible = False

cmdClear.Enabled = False

Call ListBox1_Click

Application.ScreenUpdating = True

Application.Calculation = xlAutomatic

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then

Cancel = True

MsgBox "Tombol X tidak diaktifkan, silahkan klik tombol Close untuk menutup form.", vbCritical

End If

End Sub
KODE FORM PB

'Variable Declaration

Dim BlnVal As Boolean

Private Sub UserForm_Initialize()

Dim IdVal As Integer

'Finding last row in the Data Sheet

IdVal = fn_LastRow(Sheets("dtbasePB"))

'Update next available id on the userform

'formInput.txtId.Value = IdVal

frmPB.txtId.Value = Sheet5.Range("A3").Value

frmPB.txtId.ForeColor = rgbBlack

frmPB.Caption = Sheet2.Range("D44").Value

frmPB.BackColor = RGB(0, 176, 240)

lbl_0.BackColor = RGB(0, 176, 240)

lbl_10.BackColor = RGB(0, 176, 240)

lbl_10.Caption = " " & Sheet2.Range("F46").Value

lbl_1.BackColor = RGB(0, 176, 240)

lbl_1.Caption = " " & Sheet2.Range("F48").Value

lbl_2.BackColor = RGB(0, 176, 240)

lbl_2.Caption = " " & Sheet2.Range("F50").Value

lbl_namaB.BackColor = RGB(0, 176, 240)

lbl_namaB.Caption = " " & Sheet2.Range("F52").Value


lbl_qty.BackColor = RGB(0, 176, 240)

lbl_qty.Caption = " " & Sheet2.Range("F54").Value

lbl_satuan.BackColor = RGB(0, 176, 240)

lbl_satuan.Caption = " " & Sheet2.Range("F25").Value

lbl_no.BackColor = RGB(0, 176, 240)

lbl_kode.Caption = " " & Sheet2.Range("F21").Value

lbl_kode.BackColor = RGB(0, 176, 240)

If Sheet2.Range("B56").Value = 1 Then

Frame1.ScrollBars = fmScrollBarsNone

frmPB.Height = 434

Frame1.Height = 318

cmdSaveE.Top = 378

cmdDel.Top = 378

cmdAdd.Top = 378

cmdClear.Top = 378

cmdCancel.Top = 378

cmdEdit.Top = 378

ElseIf Sheet2.Range("B56").Value = 2 Then

Frame1.ScrollBars = fmScrollBarsNone

Frame2.Visible = True

ElseIf Sheet2.Range("B56").Value = 3 Then

Frame1.ScrollBars = fmScrollBarsVertical

Frame1.ScrollHeight = 500

Frame2.Visible = True

Frame3.Visible = True

End If
End Sub

Function fn_LastRow(ByVal Sht As Worksheet)

Dim lastrow As Long

Set Sht = Sheets("dtbasePB")

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

fn_LastRow = lRow

End Function

Sub cmdAdd_Click()

'Boolean Value

BlnVal = 0

'Data Validation

Call Data_Validation

'Check validation of all fields are completed are not

If BlnVal = 0 Then Exit Sub

'TurnOff screen updating


With Application

.ScreenUpdating = False

.EnableEvents = False

End With

'Variable declaration

Dim txtId, cbx_tgl, cbx_bln, cbx_thn, cbx_nama1, txt_qty1, txt_1, cbx_unit

Dim iCnt As Integer

'find next available row to update data in the data worksheet

iCnt = fn_LastRow(Sheets("dtbasePB")) + 1

Application.Calculation = xlCalculationManual

'Update userform data to the Data Worksheet

With Sheets("dtbasePB")

If Sheet2.Range("B56").Value = 1 Then

'.Cells(iCnt, 1) = iCnt - 1

.Cells(iCnt, 1) = frmPB.txtId.Value

.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value


.Cells(iCnt, 11) = frmPB.cbx_nama3.Value

.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

ElseIf Sheet2.Range("B56").Value = 2 Then

.Cells(iCnt, 1) = frmPB.txtId.Value

.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value


.Cells(iCnt, 11) = frmPB.cbx_nama3.Value

.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

.Cells(iCnt, 27) = frmPB.cbx_nama11.Value

.Cells(iCnt, 28) = frmPB.txt_qty11.Value

.Cells(iCnt, 29) = frmPB.cbx_nama12.Value

.Cells(iCnt, 30) = frmPB.txt_qty12.Value

.Cells(iCnt, 31) = frmPB.cbx_nama13.Value

.Cells(iCnt, 32) = frmPB.txt_qty13.Value

.Cells(iCnt, 33) = frmPB.cbx_nama14.Value

.Cells(iCnt, 34) = frmPB.txt_qty14.Value

.Cells(iCnt, 35) = frmPB.cbx_nama15.Value

.Cells(iCnt, 36) = frmPB.txt_qty15.Value

ElseIf Sheet2.Range("B56").Value = 3 Then


.Cells(iCnt, 1) = frmPB.txtId.Value

.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value

.Cells(iCnt, 11) = frmPB.cbx_nama3.Value

.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

.Cells(iCnt, 27) = frmPB.cbx_nama11.Value


.Cells(iCnt, 28) = frmPB.txt_qty11.Value

.Cells(iCnt, 29) = frmPB.cbx_nama12.Value

.Cells(iCnt, 30) = frmPB.txt_qty12.Value

.Cells(iCnt, 31) = frmPB.cbx_nama13.Value

.Cells(iCnt, 32) = frmPB.txt_qty13.Value

.Cells(iCnt, 33) = frmPB.cbx_nama14.Value

.Cells(iCnt, 34) = frmPB.txt_qty14.Value

.Cells(iCnt, 35) = frmPB.cbx_nama15.Value

.Cells(iCnt, 36) = frmPB.txt_qty15.Value

.Cells(iCnt, 37) = frmPB.cbx_nama16.Value

.Cells(iCnt, 38) = frmPB.txt_qty16.Value

.Cells(iCnt, 39) = frmPB.cbx_nama17.Value

.Cells(iCnt, 40) = frmPB.txt_qty17.Value

.Cells(iCnt, 41) = frmPB.cbx_nama18.Value

.Cells(iCnt, 42) = frmPB.txt_qty18.Value

.Cells(iCnt, 43) = frmPB.cbx_nama19.Value

.Cells(iCnt, 44) = frmPB.txt_qty19.Value

.Cells(iCnt, 45) = frmPB.cbx_nama20.Value

.Cells(iCnt, 46) = frmPB.txt_qty20.Value

End If

MsgBox "Transaksi Permintaan Barang berhasil ditambahkan...!", vbInformation, "Permintaan


Barang"

frmPB.cmdClear.SetFocus

End With

'Variable declaration

Dim IdVal As Integer

'Finding last row in the Data Sheet


IdVal = fn_LastRow(Sheets("dtbasePB"))

'Update next available id on the userform

'formInput.txtId = IdVal

frmPB.txtId = Sheet5.Range("A3").Value

ErrOccured:

'TurnOn screen updating

Application.ScreenUpdating = True

Application.EnableEvents = True

'Application.Calculation = xlAutomatic

frmPB.txt_1.Value = ""

frmPB.cbx_unit.Value = ""

frmPB.cbx_nama1.Value = ""

frmPB.txt_qty1.Value = ""

frmPB.cbx_nama2.Value = ""

frmPB.txt_qty2.Value = ""

frmPB.cbx_nama3.Value = ""

frmPB.txt_qty3.Value = ""

frmPB.cbx_nama4.Value = ""

frmPB.txt_qty4.Value = ""

frmPB.cbx_nama5.Value = ""

frmPB.txt_qty5.Value = ""

frmPB.cbx_nama6.Value = ""

frmPB.txt_qty6.Value = ""
frmPB.cbx_nama7.Value = ""

frmPB.txt_qty7.Value = ""

frmPB.cbx_nama8.Value = ""

frmPB.txt_qty8.Value = ""

frmPB.cbx_nama9.Value = ""

frmPB.txt_qty9.Value = ""

frmPB.cbx_nama10.Value = ""

frmPB.txt_qty10.Value = ""

frmPB.txt_qty10.Value = ""

Frame2.Visible = False

Frame3.Visible = False

'frmNB.Frame1.Enabled = False

frmPB.cmdCancel.SetFocus

Application.Calculation = xlCalculationAutomatic

End Sub

Sub Data_Validation()

If frmPB.cbx_tgl = "" Then

MsgBox "Tanggal belum diisi!", vbInformation, "Tanggal"

frmPB.cbx_tgl.SetFocus

Exit Sub

ElseIf frmPB.cbx_bln = "" Then

MsgBox "Bulan belum diisi!", vbInformation, "Bulan"

frmPB.cbx_bln.SetFocus

ElseIf frmPB.cbx_thn = "" Then


MsgBox "Tahun belum diisi!", vbInformation, "Tahun"

frmPB.cbx_thn.SetFocus

ElseIf frmPB.txt_1 = "" Then

MsgBox Sheet2.Range("F48").Value & " belum diisi!", vbInformation, Sheet2.Range("F48").Value

frmPB.txt_1.SetFocus

ElseIf frmPB.cbx_unit = "" Then

MsgBox Sheet2.Range("F50").Value & " belum diisi!", vbInformation, Sheet2.Range("F50").Value

frmPB.txt_1.SetFocus

ElseIf frmPB.cbx_nama1 = "" Then

MsgBox Sheet2.Range("F34").Value & " belum diisi!", vbInformation, Sheet2.Range("F34").Value

frmPB.cbx_nama1.SetFocus

ElseIf frmPB.txt_qty1 = "" Then

MsgBox Sheet2.Range("F36").Value & " belum diisi!", vbInformation, Sheet2.Range("F36").Value

frmPB.txt_qty1.SetFocus

Else

BlnVal = 1

End If

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

Set Sht = Sheet7

Dim lastrow As Long

lastrow = Sht.Cells(Rows.Count, "A").End(xlUp).Row

Application.Calculation = xlCalculationManual

If Sht.Range("A2").Value = "" Then

Unload Me
ElseIf Sht.Range("A2").Value >= 1 Then

Sht.Range("AU2").Formula = "=DATE(RC[-43],MATCH(RC[-44],bln,0),RC[-45])"

Sht.Range("AU2").AutoFill Destination:=Sht.Range("AU2:AU" & lastrow)

Sht.Range("AV2").Formula = "=RC[-41]&RC3&RC4"

Sht.Range("AV2").AutoFill Destination:=Sht.Range("AV2:AV" & lastrow)

Sht.Range("AW2").Formula = "=RC[-40]&RC3&RC4"

Sht.Range("AW2").AutoFill Destination:=Sht.Range("AW2:AW" & lastrow)

Sht.Range("AX2").Formula = "=RC[-39]&RC3&RC4"

Sht.Range("AX2").AutoFill Destination:=Sht.Range("AX2:AX" & lastrow)

Sht.Range("AY2").Formula = "=RC[-38]&RC3&RC4"

Sht.Range("AY2").AutoFill Destination:=Sht.Range("AY2:AY" & lastrow)

Sht.Range("AZ2").Formula = "=RC[-37]&RC3&RC4"

Sht.Range("AZ2").AutoFill Destination:=Sht.Range("AZ2:AZ" & lastrow)

Sht.Range("BA2").Formula = "=RC[-36]&RC3&RC4"

Sht.Range("BA2").AutoFill Destination:=Sht.Range("BA2:BA" & lastrow)

Sht.Range("BB2").Formula = "=RC[-35]&RC3&RC4"

Sht.Range("BB2").AutoFill Destination:=Sht.Range("BB2:BB" & lastrow)

Sht.Range("BC2").Formula = "=RC[-34]&RC3&RC4"

Sht.Range("BC2").AutoFill Destination:=Sht.Range("BC2:BC" & lastrow)

Sht.Range("BD2").Formula = "=RC[-33]&RC3&RC4"

Sht.Range("BD2").AutoFill Destination:=Sht.Range("BD2:BD" & lastrow)

Sht.Range("BE2").Formula = "=RC[-32]&RC3&RC4"

Sht.Range("BE2").AutoFill Destination:=Sht.Range("BE2:BE" & lastrow)

Sht.Range("BF2").Formula = "=RC[-31]&RC3&RC4"

Sht.Range("BF2").AutoFill Destination:=Sht.Range("BF2:BF" & lastrow)

Sht.Range("BG2").Formula = "=RC[-30]&RC3&RC4"

Sht.Range("BG2").AutoFill Destination:=Sht.Range("BG2:BG" & lastrow)


Sht.Range("BH2").Formula = "=RC[-29]&RC3&RC4"

Sht.Range("BH2").AutoFill Destination:=Sht.Range("BH2:BH" & lastrow)

Sht.Range("BI2").Formula = "=RC[-28]&RC3&RC4"

Sht.Range("BI2").AutoFill Destination:=Sht.Range("BI2:BI" & lastrow)

Sht.Range("BJ2").Formula = "=RC[-27]&RC3&RC4"

Sht.Range("BJ2").AutoFill Destination:=Sht.Range("BJ2:BJ" & lastrow)

Sht.Range("BK2").Formula = "=RC[-26]&RC3&RC4"

Sht.Range("BK2").AutoFill Destination:=Sht.Range("BK2:BK" & lastrow)

Sht.Range("BL2").Formula = "=RC[-25]&RC3&RC4"

Sht.Range("BL2").AutoFill Destination:=Sht.Range("BL2:BL" & lastrow)

Sht.Range("BM2").Formula = "=RC[-24]&RC3&RC4"

Sht.Range("BM2").AutoFill Destination:=Sht.Range("BM2:BM" & lastrow)

Sht.Range("BN2").Formula = "=RC[-23]&RC3&RC4"

Sht.Range("BN2").AutoFill Destination:=Sht.Range("BN2:BN" & lastrow)

Sht.Range("BO2").Formula = "=RC[-22]&RC3&RC4"

Sht.Range("BO2").AutoFill Destination:=Sht.Range("BO2:BO" & lastrow)

End If

Sheet5.Range("E2:E21").ClearContents

Unload Me

Application.ScreenUpdating = True

Application.Calculation = xlCalculationAutomatic

End Sub

Private Sub cmdClear_Click()

Application.ScreenUpdating = False

'formInput.txtId = Sheet9.Range("A2").Value

frmPB.cbx_tgl.Value = ""

frmPB.cbx_bln.Value = ""
frmPB.cbx_thn.Value = ""

frmPB.txt_1.Value = ""

frmPB.cbx_unit.Value = ""

frmPB.cbx_nama1.Value = ""

frmPB.txt_qty1.Value = ""

frmPB.cbx_nama2.Value = ""

frmPB.txt_qty2.Value = ""

frmPB.cbx_nama3.Value = ""

frmPB.txt_qty3.Value = ""

frmPB.cbx_nama4.Value = ""

frmPB.txt_qty4.Value = ""

frmPB.cbx_nama5.Value = ""

frmPB.txt_qty5.Value = ""

frmPB.cbx_nama6.Value = ""

frmPB.txt_qty6.Value = ""

frmPB.cbx_nama7.Value = ""

frmPB.txt_qty7.Value = ""

frmPB.cbx_nama8.Value = ""

frmPB.txt_qty8.Value = ""

frmPB.cbx_nama9.Value = ""

frmPB.txt_qty9.Value = ""

frmPB.cbx_nama10.Value = ""

frmPB.txt_qty10.Value = ""

frmPB.txt_qty10.Value = ""

Frame2.Visible = False

Frame3.Visible = False

Application.ScreenUpdating = True
Application.Calculation = xlAutomatic

End Sub

Private Sub ComboBox1_Change()

ListBox1.Value = ComboBox1.Value

End Sub

Private Sub cmdDel_Click()

Dim baris As Integer

Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

baris = IndexListbox + 1

With Sheets("dtbasePB")

lDel = MsgBox("Anda yakin akan menghapus data nomor " & ListBox1.Value & "?", vbCritical +
vbYesNo, "Hapus Data")

If lDel = vbYes Then

With Sheets("dtbasePB")

With .Cells(baris, "A")

Application.DisplayAlerts = False

.EntireRow.Delete

Application.DisplayAlerts = True

MsgBox "Data berhasil dihapus...!"

End With
End With

Else

MsgBox "Hapus data dibatalkan...!"

End If

Application.Calculation = xlCalculationAutomatic

End With

End If

End Sub

Private Sub cmdEdit_Click()

' ComboBox2.Visible = True

' ComboBox2.SetFocus

ComboBox1.Visible = True

' ComboBox1.Enabled = False

ComboBox1.BackColor = rgbYellow

cmdSaveE.Visible = True

cmdSaveE.Enabled = True

cmdDel.Visible = True

cmdDel.Enabled = True

txtId.Visible = False

cmdAdd.Visible = False

cmdClear.Enabled = False

'Frame1.Enabled = True

End Sub
Private Sub cmdSaveE_Click()

Dim iCnt As Integer

Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

iCnt = IndexListbox + 1

Application.Calculation = xlCalculationManual

With Sheets("dtbasePB")

On Error Resume Next

If Sheet2.Range("B56").Value = 1 Then

'.Cells(iCnt, 1) = iCnt - 1

.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value

.Cells(iCnt, 11) = frmPB.cbx_nama3.Value


.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

ElseIf Sheet2.Range("B56").Value = 2 Then

.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value

.Cells(iCnt, 11) = frmPB.cbx_nama3.Value


.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

.Cells(iCnt, 27) = frmPB.cbx_nama11.Value

.Cells(iCnt, 28) = frmPB.txt_qty11.Value

.Cells(iCnt, 29) = frmPB.cbx_nama12.Value

.Cells(iCnt, 30) = frmPB.txt_qty12.Value

.Cells(iCnt, 31) = frmPB.cbx_nama13.Value

.Cells(iCnt, 32) = frmPB.txt_qty13.Value

.Cells(iCnt, 33) = frmPB.cbx_nama14.Value

.Cells(iCnt, 34) = frmPB.txt_qty14.Value

.Cells(iCnt, 35) = frmPB.cbx_nama15.Value

.Cells(iCnt, 36) = frmPB.txt_qty15.Value

ElseIf Sheet2.Range("B56").Value = 3 Then


.Cells(iCnt, 2) = frmPB.cbx_tgl.Value

.Cells(iCnt, 3) = frmPB.cbx_bln.Value

.Cells(iCnt, 4) = frmPB.cbx_thn.Value

.Cells(iCnt, 5) = frmPB.txt_1.Value

.Cells(iCnt, 6) = frmPB.cbx_unit.Value

.Cells(iCnt, 7) = frmPB.cbx_nama1.Value

.Cells(iCnt, 8) = frmPB.txt_qty1.Value

.Cells(iCnt, 9) = frmPB.cbx_nama2.Value

.Cells(iCnt, 10) = frmPB.txt_qty2.Value

.Cells(iCnt, 11) = frmPB.cbx_nama3.Value

.Cells(iCnt, 12) = frmPB.txt_qty3.Value

.Cells(iCnt, 13) = frmPB.cbx_nama4.Value

.Cells(iCnt, 14) = frmPB.txt_qty4.Value

.Cells(iCnt, 15) = frmPB.cbx_nama5.Value

.Cells(iCnt, 16) = frmPB.txt_qty5.Value

.Cells(iCnt, 17) = frmPB.cbx_nama6.Value

.Cells(iCnt, 18) = frmPB.txt_qty6.Value

.Cells(iCnt, 19) = frmPB.cbx_nama7.Value

.Cells(iCnt, 20) = frmPB.txt_qty7.Value

.Cells(iCnt, 21) = frmPB.cbx_nama8.Value

.Cells(iCnt, 22) = frmPB.txt_qty8.Value

.Cells(iCnt, 23) = frmPB.cbx_nama9.Value

.Cells(iCnt, 24) = frmPB.txt_qty9.Value

.Cells(iCnt, 25) = frmPB.cbx_nama10.Value

.Cells(iCnt, 26) = frmPB.txt_qty10.Value

.Cells(iCnt, 27) = frmPB.cbx_nama11.Value

.Cells(iCnt, 28) = frmPB.txt_qty11.Value


.Cells(iCnt, 29) = frmPB.cbx_nama12.Value

.Cells(iCnt, 30) = frmPB.txt_qty12.Value

.Cells(iCnt, 31) = frmPB.cbx_nama13.Value

.Cells(iCnt, 32) = frmPB.txt_qty13.Value

.Cells(iCnt, 33) = frmPB.cbx_nama14.Value

.Cells(iCnt, 34) = frmPB.txt_qty14.Value

.Cells(iCnt, 35) = frmPB.cbx_nama15.Value

.Cells(iCnt, 36) = frmPB.txt_qty15.Value

.Cells(iCnt, 37) = frmPB.cbx_nama16.Value

.Cells(iCnt, 38) = frmPB.txt_qty16.Value

.Cells(iCnt, 39) = frmPB.cbx_nama17.Value

.Cells(iCnt, 40) = frmPB.txt_qty17.Value

.Cells(iCnt, 41) = frmPB.cbx_nama18.Value

.Cells(iCnt, 42) = frmPB.txt_qty18.Value

.Cells(iCnt, 43) = frmPB.cbx_nama19.Value

.Cells(iCnt, 44) = frmPB.txt_qty19.Value

.Cells(iCnt, 45) = frmPB.cbx_nama20.Value

.Cells(iCnt, 46) = frmPB.txt_qty20.Value

End If

MsgBox "Data Berhasil diEdit!", vbInformation, "Edit Data"

End With

End If

'Frame1.Enabled = False

cmdCancel.SetFocus

Application.Calculation = xlCalculationManual

frmPB.cbx_tgl.Value = ""

frmPB.cbx_bln.Value = ""
frmPB.cbx_thn.Value = ""

frmPB.txt_1.Value = ""

frmPB.cbx_unit.Value = ""

frmPB.cbx_nama1.Value = ""

frmPB.txt_qty1.Value = ""

frmPB.cbx_nama2.Value = ""

frmPB.txt_qty2.Value = ""

frmPB.cbx_nama3.Value = ""

frmPB.txt_qty3.Value = ""

frmPB.cbx_nama4.Value = ""

frmPB.txt_qty4.Value = ""

frmPB.cbx_nama5.Value = ""

frmPB.txt_qty5.Value = ""

frmPB.cbx_nama6.Value = ""

frmPB.txt_qty6.Value = ""

frmPB.cbx_nama7.Value = ""

frmPB.txt_qty7.Value = ""

frmPB.cbx_nama8.Value = ""

frmPB.txt_qty8.Value = ""

frmPB.cbx_nama9.Value = ""

frmPB.txt_qty9.Value = ""

frmPB.cbx_nama10.Value = ""

frmPB.txt_qty10.Value = ""

Frame2.Visible = False

Frame3.Visible = False

cmdDel.Enabled = False

cmdAdd.Enabled = False
cmdSaveE.Enabled = False

Application.Calculation = xlAutomatic

End Sub

Private Sub ListBox1_Click()

Application.Calculation = xlCalculationManual

txtId.Value = ListBox1.List(ListBox1.ListIndex, 0)

cbx_tgl.Value = ListBox1.List(ListBox1.ListIndex, 1)

cbx_bln.Value = ListBox1.List(ListBox1.ListIndex, 2)

cbx_thn.Value = ListBox1.List(ListBox1.ListIndex, 3)

txt_1.Value = ListBox1.List(ListBox1.ListIndex, 4)

cbx_unit.Value = ListBox1.List(ListBox1.ListIndex, 5)

cbx_nama1.Value = ListBox1.List(ListBox1.ListIndex, 6)

txt_qty1.Value = ListBox1.List(ListBox1.ListIndex, 7)

cbx_nama2.Value = ListBox1.List(ListBox1.ListIndex, 8)

txt_qty2.Value = ListBox1.List(ListBox1.ListIndex, 9)

cbx_nama3.Value = ListBox1.List(ListBox1.ListIndex, 10)

txt_qty3.Value = ListBox1.List(ListBox1.ListIndex, 11)

cbx_nama4.Value = ListBox1.List(ListBox1.ListIndex, 12)

txt_qty4.Value = ListBox1.List(ListBox1.ListIndex, 13)

cbx_nama5.Value = ListBox1.List(ListBox1.ListIndex, 14)

txt_qty5.Value = ListBox1.List(ListBox1.ListIndex, 15)

cbx_nama6.Value = ListBox1.List(ListBox1.ListIndex, 16)

txt_qty6.Value = ListBox1.List(ListBox1.ListIndex, 17)

cbx_nama7.Value = ListBox1.List(ListBox1.ListIndex, 18)

txt_qty7.Value = ListBox1.List(ListBox1.ListIndex, 19)


cbx_nama8.Value = ListBox1.List(ListBox1.ListIndex, 20)

txt_qty8.Value = ListBox1.List(ListBox1.ListIndex, 21)

cbx_nama9.Value = ListBox1.List(ListBox1.ListIndex, 22)

txt_qty9.Value = ListBox1.List(ListBox1.ListIndex, 23)

cbx_nama10.Value = ListBox1.List(ListBox1.ListIndex, 24)

txt_qty10.Value = ListBox1.List(ListBox1.ListIndex, 25)

cbx_nama11.Value = ListBox1.List(ListBox1.ListIndex, 26)

txt_qty11.Value = ListBox1.List(ListBox1.ListIndex, 27)

cbx_nama12.Value = ListBox1.List(ListBox1.ListIndex, 28)

txt_qty12.Value = ListBox1.List(ListBox1.ListIndex, 29)

cbx_nama13.Value = ListBox1.List(ListBox1.ListIndex, 30)

txt_qty13.Value = ListBox1.List(ListBox1.ListIndex, 31)

cbx_nama14.Value = ListBox1.List(ListBox1.ListIndex, 32)

txt_qty14.Value = ListBox1.List(ListBox1.ListIndex, 33)

cbx_nama15.Value = ListBox1.List(ListBox1.ListIndex, 34)

txt_qty15.Value = ListBox1.List(ListBox1.ListIndex, 35)

cbx_nama16.Value = ListBox1.List(ListBox1.ListIndex, 36)

txt_qty16.Value = ListBox1.List(ListBox1.ListIndex, 37)

cbx_nama17.Value = ListBox1.List(ListBox1.ListIndex, 38)

txt_qty17.Value = ListBox1.List(ListBox1.ListIndex, 39)

cbx_nama18.Value = ListBox1.List(ListBox1.ListIndex, 40)

txt_qty18.Value = ListBox1.List(ListBox1.ListIndex, 41)

cbx_nama19.Value = ListBox1.List(ListBox1.ListIndex, 42)

txt_qty19.Value = ListBox1.List(ListBox1.ListIndex, 43)

cbx_nama20.Value = ListBox1.List(ListBox1.ListIndex, 44)

txt_qty20.Value = ListBox1.List(ListBox1.ListIndex, 45)

Application.Calculation = xlAutomatic
Application.ScreenUpdating = True

End Sub

Private Sub cbx_nama1_Change()

Sheet5.Range("E2").Value = cbx_nama1.Value

Sheet5.Range("F2").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan1.Value = Sheet5.Range("F2").Value

Sheet5.Range("G2").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode1.Value = Sheet5.Range("G2").Value

End Sub

Private Sub cbx_nama2_Change()

Sheet5.Range("E3").Value = cbx_nama2.Value

Sheet5.Range("F3").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan2.Value = Sheet5.Range("F3").Value

Sheet5.Range("G3").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode2.Value = Sheet5.Range("G3").Value

End Sub

Private Sub cbx_nama3_Change()

Sheet5.Range("E4").Value = cbx_nama3.Value

Sheet5.Range("F4").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan3.Value = Sheet5.Range("F4").Value

Sheet5.Range("G4").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode3.Value = Sheet5.Range("G4").Value

End Sub
Private Sub cbx_nama4_Change()

Sheet5.Range("E5").Value = cbx_nama4.Value

Sheet5.Range("F5").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan4.Value = Sheet5.Range("F5").Value

Sheet5.Range("G5").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode4.Value = Sheet5.Range("G5").Value

End Sub

Private Sub cbx_nama5_Change()

Sheet5.Range("E6").Value = cbx_nama5.Value

Sheet5.Range("F6").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan5.Value = Sheet5.Range("F6").Value

Sheet5.Range("G6").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode5.Value = Sheet5.Range("G6").Value

End Sub

Private Sub cbx_nama6_Change()

Sheet5.Range("E7").Value = cbx_nama6.Value

Sheet5.Range("F7").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan6.Value = Sheet5.Range("F7").Value

Sheet5.Range("G7").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode6.Value = Sheet5.Range("G7").Value

End Sub

Private Sub cbx_nama7_Change()

Sheet5.Range("E8").Value = cbx_nama7.Value
Sheet5.Range("F8").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan7.Value = Sheet5.Range("F8").Value

Sheet5.Range("G8").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode7.Value = Sheet5.Range("G8").Value

End Sub

Private Sub cbx_nama8_Change()

Sheet5.Range("E9").Value = cbx_nama8.Value

Sheet5.Range("F9").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan8.Value = Sheet5.Range("F9").Value

Sheet5.Range("G9").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode8.Value = Sheet5.Range("G9").Value

End Sub

Private Sub cbx_nama9_Change()

Sheet5.Range("E10").Value = cbx_nama9.Value

Sheet5.Range("F10").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan9.Value = Sheet5.Range("F10").Value

Sheet5.Range("G10").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode9.Value = Sheet5.Range("G10").Value

End Sub

Private Sub cbx_nama10_Change()

Sheet5.Range("E11").Value = cbx_nama10.Value

Sheet5.Range("F11").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan10.Value = Sheet5.Range("F11").Value
Sheet5.Range("G11").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode10.Value = Sheet5.Range("G11").Value

End Sub

Private Sub cbx_nama11_Change()

Sheet5.Range("E12").Value = cbx_nama11.Value

Sheet5.Range("F12").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan11.Value = Sheet5.Range("F12").Value

Sheet5.Range("G12").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode11.Value = Sheet5.Range("G12").Value

End Sub

Private Sub cbx_nama12_Change()

Sheet5.Range("E13").Value = cbx_nama12.Value

Sheet5.Range("F13").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan12.Value = Sheet5.Range("F13").Value

Sheet5.Range("G13").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode12.Value = Sheet5.Range("G13").Value

End Sub

Private Sub cbx_nama13_Change()

Sheet5.Range("E14").Value = cbx_nama13.Value

Sheet5.Range("F14").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan13.Value = Sheet5.Range("F14").Value

Sheet5.Range("G14").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode13.Value = Sheet5.Range("G14").Value
End Sub

Private Sub cbx_nama14_Change()

Sheet5.Range("E15").Value = cbx_nama14.Value

Sheet5.Range("F15").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan14.Value = Sheet5.Range("F15").Value

Sheet5.Range("G15").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode14.Value = Sheet5.Range("G15").Value

End Sub

Private Sub cbx_nama15_Change()

Sheet5.Range("E16").Value = cbx_nama15.Value

Sheet5.Range("F16").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan15.Value = Sheet5.Range("F16").Value

Sheet5.Range("G16").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode15.Value = Sheet5.Range("G16").Value

End Sub

Private Sub cbx_nama16_Change()

Sheet5.Range("E17").Value = cbx_nama16.Value

Sheet5.Range("F17").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan16.Value = Sheet5.Range("F17").Value

Sheet5.Range("G17").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode16.Value = Sheet5.Range("G17").Value

End Sub

Private Sub cbx_nama17_Change()

Sheet5.Range("E18").Value = cbx_nama17.Value
Sheet5.Range("F18").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan17.Value = Sheet5.Range("F18").Value

Sheet5.Range("G18").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode17.Value = Sheet5.Range("G18").Value

End Sub

Private Sub cbx_nama18_Change()

Sheet5.Range("E19").Value = cbx_nama18.Value

Sheet5.Range("F19").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan18.Value = Sheet5.Range("F19").Value

Sheet5.Range("G19").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode18.Value = Sheet5.Range("G19").Value

End Sub

Private Sub cbx_nama19_Change()

Sheet5.Range("E20").Value = cbx_nama19.Value

Sheet5.Range("F20").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan19.Value = Sheet5.Range("F20").Value

Sheet5.Range("G20").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode19.Value = Sheet5.Range("G20").Value

End Sub

Private Sub cbx_nama20_Change()

Sheet5.Range("E21").Value = cbx_nama20.Value

Sheet5.Range("F21").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan20.Value = Sheet5.Range("F21").Value
Sheet5.Range("G21").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"

txt_kode20.Value = Sheet5.Range("G21").Value

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then

Cancel = True

MsgBox "Tombol X tidak diaktifkan, silahkan klik tombol Close untuk menutup form.", vbCritical

End If

End Sub
KODE FORM SB

'Variable Declaration

Dim BlnVal As Boolean

Private Sub UserForm_Initialize()

Dim IdVal As Integer

'Finding last row in the Data Sheet

IdVal = fn_LastRow(Sheets("dtbaseSB"))

'Update next available id on the userform

'formInput.txtId.Value = IdVal

frmSB.txtId.Value = Sheet5.Range("A2").Value

frmSB.txtId.ForeColor = rgbBlack

frmSB.Caption = Sheet2.Range("D30").Value

frmSB.BackColor = RGB(0, 176, 240)

lbl_kode.BackColor = RGB(0, 176, 240)

lbl_0.BackColor = RGB(0, 176, 240)

lbl_1.Caption = " " & Sheet2.Range("F32").Value

lbl_1.BackColor = RGB(0, 176, 240)

lbl_2.Caption = " " & Sheet2.Range("F34").Value

lbl_2.BackColor = RGB(0, 176, 240)

lbl_3.Caption = " " & Sheet2.Range("F36").Value

lbl_3.BackColor = RGB(0, 176, 240)

If Sheet2.Range("B38").Value = True Then


lbl_4.Visible = True

txt_1.Visible = True

lbl_4.BackColor = RGB(0, 176, 240)

lbl_4.Caption = " " & Sheet2.Range("F38").Value

ElseIf Sheet2.Range("B38").Value = False Then

lbl_4.Visible = False

txt_1.Visible = False

End If

If Sheet2.Range("B40").Value = True Then

lbl_5.Visible = True

txt_2.Visible = True

lbl_5.BackColor = RGB(0, 176, 240)

lbl_5.Caption = " " & Sheet2.Range("F40").Value

ElseIf Sheet2.Range("B40").Value = False Then

lbl_5.Visible = False

txt_2.Visible = False

End If

If Sheet2.Range("B42").Value = True Then

lbl_6.Visible = True

txt_3.Visible = True

lbl_6.BackColor = RGB(0, 176, 240)

lbl_6.Caption = " " & Sheet2.Range("F42").Value

ElseIf Sheet2.Range("B42").Value = False Then

lbl_6.Visible = False

txt_3.Visible = False
End If

End Sub

Function fn_LastRow(ByVal Sht As Worksheet)

Dim lastrow As Long

Set Sht = Sheets("dtbaseSB")

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

fn_LastRow = lRow

End Function

Sub cmdAdd_Click()

'Boolean Value

BlnVal = 0

'Data Validation

Call Data_Validation

'Check validation of all fields are completed are not

If BlnVal = 0 Then Exit Sub

'TurnOff screen updating


With Application

.ScreenUpdating = False

.EnableEvents = False

End With

'Variable declaration

Dim txtId, cbx_tgl, cbx_bln, cbx_thn, cbx_namaB, txt_qty, txt_1, txt_2, txt_3

Dim iCnt As Integer

'find next available row to update data in the data worksheet

iCnt = fn_LastRow(Sheets("dtbaseSB")) + 1

Application.Calculation = xlCalculationManual

'Update userform data to the Data Worksheet

With Sheets("dtbaseSB")

On Error Resume Next

.Cells(iCnt, 1) = frmSB.txtId.Value

.Cells(iCnt, 2) = frmSB.cbx_tgl.Value

.Cells(iCnt, 3) = frmSB.cbx_bln.Value

.Cells(iCnt, 4) = frmSB.cbx_thn.Value

.Cells(iCnt, 5) = frmSB.cbx_namaB.Value

.Cells(iCnt, 6) = frmSB.txt_qty.Value

.Cells(iCnt, 7) = Format(frmSB.txt_1.Value * 1, "###0")

.Cells(iCnt, 8) = Format(frmSB.txt_2.Value * 1, "###0")

.Cells(iCnt, 9) = frmSB.txt_3.Value

MsgBox "Stock Barang berhasil ditambahkan...!", vbInformation, "Stock Barang"

frmSB.cmdClear.SetFocus
End With

'Variable declaration

Dim IdVal As Integer

'Finding last row in the Data Sheet

IdVal = fn_LastRow(Sheets("dtbaseSB"))

'Update next available id on the userform

'formInput.txtId = IdVal

frmNB.txtId = Sheet5.Range("A2").Value

ErrOccured:

'TurnOn screen updating

Application.ScreenUpdating = True

Application.EnableEvents = True

frmSB.cbx_namaB.Value = ""

frmSB.txt_qty.Value = ""

frmSB.txt_1.Value = ""

frmSB.txt_2.Value = ""

frmSB.txt_3.Value = ""

frmSB.cmdCancel.SetFocus

Application.Calculation = xlCalculationAutomatic

Application.ScreenUpdating = True

End Sub

Sub Data_Validation()
If frmSB.cbx_tgl = "" Then

MsgBox "Tanggal belum diisi!", vbInformation, "Tanggal"

frmSB.cbx_tgl.SetFocus

Exit Sub

ElseIf frmSB.cbx_bln = "" Then

MsgBox "Bulan belum diisi!", vbInformation, "Bulan"

frmSB.cbx_bln.SetFocus

ElseIf frmSB.cbx_thn = "" Then

MsgBox "Tahun belum diisi!", vbInformation, "Tahun"

frmSB.cbx_thn.SetFocus

ElseIf frmSB.cbx_namaB = "" Then

MsgBox Sheet2.Range("F34").Value & "Nama Barang belum diisi!", vbInformation,


Sheet2.Range("F34").Value

frmSB.cbx_namaB.SetFocus

ElseIf frmSB.txt_qty = "" Then

MsgBox Sheet2.Range("F36").Value & "Jumlah Barang belum diisi!", vbInformation,


Sheet2.Range("F36").Value

frmSB.txt_qty.SetFocus

Else

BlnVal = 1

End If

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

Set Sht = Sheet6

Dim lastrow As Long

lastrow = Sht.Cells(Rows.Count, "A").End(xlUp).Row


Application.Calculation = xlCalculationManual

If Sht.Range("A2").Value = "" Then

Unload Me

ElseIf Sht.Range("A2").Value >= 1 Then

Sht.Range("J2").Formula = "=DATE(RC[-6],MATCH(RC[-7],bln,0),RC[-8])"

Sht.Range("J2").AutoFill Destination:=Sht.Range("J2:J" & lastrow)

Sht.Range("K2").Formula = "=RC[-6]&RC[-8]&RC[-7]"

Sht.Range("K2").AutoFill Destination:=Sht.Range("K2:K" & lastrow)

End If

Sheet5.Range("E1").ClearContents

Unload Me

Application.ScreenUpdating = True

Application.Calculation = xlCalculationAutomatic

End Sub

Private Sub cmdClear_Click()

Application.ScreenUpdating = False

'formInput.txtId = Sheet9.Range("A2").Value

frmSB.cbx_tgl.Value = ""

frmSB.cbx_bln.Value = ""

frmSB.cbx_thn.Value = ""

frmSB.cbx_namaB.Value = ""

frmSB.txt_qty.Value = ""

frmSB.txt_1.Value = ""

frmSB.txt_2.Value = ""

frmSB.txt_3.Value = ""

Application.ScreenUpdating = True
Application.Calculation = xlAutomatic

End Sub

Private Sub ComboBox1_Change()

ListBox1.Value = ComboBox1.Value

End Sub

Private Sub cmdDel_Click()

Dim baris As Integer

Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

baris = IndexListbox + 1

With Sheets("dtbaseSB")

lDel = MsgBox("Anda yakin akan menghapus data nomor " & ListBox1.Value & "?", vbCritical +
vbYesNo, "Hapus Data")

If lDel = vbYes Then

With Sheets("dtbaseSB")

With .Cells(baris, "A")

Application.DisplayAlerts = False

.EntireRow.Delete

Application.DisplayAlerts = True

MsgBox "Data berhasil dihapus...!"

End With
End With

Else

MsgBox "Hapus data dibatalkan...!"

End If

End With

End If

Application.Calculation = xlCalculationAutomatic

End Sub

Private Sub cmdEdit_Click()

ComboBox2.Visible = True

ComboBox2.SetFocus

ComboBox1.Visible = True

ComboBox1.Enabled = False

ComboBox2.BackColor = rgbYellow

cmdSaveE.Visible = True

cmdSaveE.Enabled = True

cmdDel.Visible = True

cmdDel.Enabled = True

txtId.Visible = False

cmdAdd.Visible = False

cmdClear.Enabled = False

'Frame1.Enabled = True

End Sub
Private Sub cmdSaveE_Click()

Dim iCnt As Integer

Dim IndexListbox As Integer

Application.Calculation = xlCalculationManual

If Me.ListBox1.ListIndex = -1 Then

MsgBox "silahkan pilih data"

ElseIf Me.ListBox1.ListIndex >= 0 Then

IndexListbox = Me.ListBox1.ListIndex

iCnt = IndexListbox + 1

Application.Calculation = xlCalculationManual

With Sheets("dtbaseSB")

On Error Resume Next

.Cells(iCnt, 2) = frmSB.cbx_tgl.Value

.Cells(iCnt, 3) = frmSB.cbx_bln.Value

.Cells(iCnt, 4) = frmSB.cbx_thn.Value

.Cells(iCnt, 5) = frmSB.cbx_namaB.Value

.Cells(iCnt, 6) = frmSB.txt_qty.Value

.Cells(iCnt, 7) = Format(frmSB.txt_1.Value * 1, "###0")

.Cells(iCnt, 8) = Format(frmSB.txt_2.Value * 1, "###0")

.Cells(iCnt, 9) = frmSB.txt_3.Value

MsgBox "Data Berhasil diEdit!", vbInformation, "Edit Data"

End With

End If

Application.Calculation = xlCalculationManual
frmSB.cbx_tgl.Value = ""

frmSB.cbx_bln.Value = ""

frmSB.cbx_thn.Value = ""

frmSB.cbx_namaB.Value = ""

frmSB.txt_qty.Value = ""

frmSB.txt_1.Value = ""

frmSB.txt_2.Value = ""

frmSB.txt_3.Value = ""

cmdDel.Enabled = False

cmdAdd.Enabled = False

cmdSaveE.Enabled = False

Application.Calculation = xlAutomatic

cmdCancel.SetFocus

End Sub

Private Sub ListBox1_Click()

Application.Calculation = xlCalculationManual

On Error Resume Next

txtId.Value = ListBox1.List(ListBox1.ListIndex, 0)

cbx_tgl.Value = ListBox1.List(ListBox1.ListIndex, 1)

cbx_bln.Value = ListBox1.List(ListBox1.ListIndex, 2)

cbx_thn.Value = ListBox1.List(ListBox1.ListIndex, 3)

cbx_namaB.Value = ListBox1.List(ListBox1.ListIndex, 4)

txt_qty.Value = ListBox1.List(ListBox1.ListIndex, 5)

txt_1.Value = Format(ListBox1.List(ListBox1.ListIndex, 6), "###0")

txt_2.Value = Format(ListBox1.List(ListBox1.ListIndex, 7), "###0")

txt_3.Value = ListBox1.List(ListBox1.ListIndex, 8)
Application.Calculation = xlCalculationAutomatic

End Sub

Private Sub ComboBox2_Change()

'Application.ScreenUpdating = False

'Application.Calculation = xlCalculationManual

ComboBox2.Visible = True

ComboBox2.BackColor = rgbYellow

ComboBox1.Value = ComboBox2.ListIndex

cmdSaveE.Visible = True

cmdDel.Visible = True

txtId.Visible = False

cmdAdd.Visible = False

cmdClear.Enabled = False

Call ListBox1_Click

Application.ScreenUpdating = True

Application.Calculation = xlAutomatic

End Sub

Private Sub cbx_namaB_Change()

Application.Calculation = xlCalculationManual

On Error Resume Next

Sheet5.Range("E1").Value = cbx_namaB.Value

Sheet5.Range("F1").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],dtbaseNB!C[-3]:C[-
2],2,FALSE),"""")"

txt_satuan.Value = Sheet5.Range("F1").Value

Sheet5.Range("G1").FormulaR1C1 = "=IFERROR(OFFSET(dtbaseNB!R1C1,MATCH('R'!RC[-
2],Nama_Barang,0)-1,1),"""")"
txt_kode.Value = Sheet5.Range("G1").Value

Application.Calculation = xlCalculationAutomatic

End Sub

Private Sub txt_1_Change()

On Error GoTo ABC

txt_1.Value = Format(txt_1 * 1, "#,##0")

Exit Sub

ABC:

txt_1 = ""

End Sub

Private Sub txt_2_Change()

On Error GoTo ABC

txt_2.Value = Format(txt_2 * 1, "#,##0")

Exit Sub

ABC:

txt_2 = ""

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then

Cancel = True

MsgBox "Tombol X tidak diaktifkan, silahkan klik tombol Close untuk menutup form.", vbCritical

End If

End Sub
KODE MODULE

Sub Auto_Open()

Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"", false)"

Form_Login.Show

End Sub

Sub Workbook_Activate()

Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"", false)"

End Sub

Sub Workbook_Deactivate()

Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"", true)"

End Sub

Sub FormNB_Show()

frmNB.Show (vbModeless)

End Sub

Sub FormSB_Show()

frmSB.Show (vbModeless)

End Sub

Sub FormPB_Show()

frmPB.Show (vbModeless)

End Sub

Sub Preview_()

MsgBox "Maaf, fitur belum dapat digunakan...!"

End Sub

Sub Print_()

Dim ws As Worksheet

Set ws = ActiveSheet

MsgBox "Maaf, fitur belum dapat digunakan...!"


ws.Protect Password:=Sheet5.Range("A4").Text, DrawingObjects:=True, Contents:=True,
Scenarios:=True _

, AllowFormattingColumns:=True, AllowFormattingRows:=True

ActiveWindow.DisplayHeadings = False

End Sub

Sub EditKol_NT()

Dim ws14 As Worksheet

Set ws14 = Sheet14

ws14.Protect Password:=Sheet5.Range("A4").Text, DrawingObjects:=True, Contents:=True,


Scenarios:=True _

, AllowFormattingColumns:=True, AllowFormattingRows:=True

ActiveWindow.DisplayHeadings = True

Range("F13").Select

End Sub

Sub OK_()

Dim ws As Worksheet

Set ws = ActiveSheet

ws.Protect Password:=Sheet5.Range("A4").Text, DrawingObjects:=True, Contents:=True,


Scenarios:=True _

, AllowFormattingColumns:=True, AllowFormattingRows:=True

ActiveWindow.DisplayHeadings = False

End Sub

Sub ubah_()

Dim ws As Worksheet

Set ws = ActiveSheet

ws.Protect Password:=Sheet5.Range("A4").Text, DrawingObjects:=False, Contents:=True,


Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True

ActiveWindow.DisplayHeadings = False

End Sub

Sub O_()

Dim ws As Worksheet

Set ws = ActiveSheet

ws.Protect Password:=Sheet5.Range("A4").Text, DrawingObjects:=True, Contents:=True,


Scenarios:=True _

, AllowFormattingColumns:=True, AllowFormattingRows:=True

MsgBox "Maaf, fitur belum dapat digunakan...!"

End Sub

S-ar putea să vă placă și