Input BBM
Input BBM
Call AdvancedCalendar
End Sub
'=======================================
' TOMBOL BERSIHKAN
'=======================================
Private Sub cmdBersihkan_Click()
BersihkanForm
End Sub
Private Sub cmshift_Change()
Dim wsInput As Worksheet
Dim kodeUnit As String
Dim shift As String
Dim tanggal As String
Dim lastRow As Long
Dim i As Long
Dim found As Boolean
'Validasi input
If Trim(kodeUnit) = "" Or Trim(shift) = "" Or Trim(tanggal) = "" Then
MsgBox "Harap isi Kode Unit, Shift, dan Tanggal terlebih dahulu!",
vbExclamation
Exit Sub
End If
End With
'Cari data
lastRow = wsInput.Cells(wsInput.Rows.Count, colKodeUnit).End(xlUp).Row
found = False
For i = 2 To lastRow
If UCase(wsInput.Cells(i, colKodeUnit).value) = UCase(kodeUnit) And _
UCase(wsInput.Cells(i, colShift).value) = UCase(shift) And _
wsInput.Cells(i, colTanggal).value = tanggal Then ' Check the selected
date
Exit Sub
ErrorHandler:
If Err.Number = 91 Then
MsgBox "Kolom header tidak ditemukan! Pastikan header berikut ada di sheet
InputDataHM:" & vbCrLf & _
"- Kode Unit" & vbCrLf & _
"- Shift" & vbCrLf & _
"- Jenis Alat" & vbCrLf & _
"- Type Alat" & vbCrLf & _
"- Merk Alat" & vbCrLf & _
"- Tanggal", vbCritical
Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
End If
End Sub
End Sub
cmb.List = dict.Keys
End Sub
Private Sub cmdSimpan_Click()
Dim wsIsi As Worksheet, wsBBM As Worksheet
Dim newStock As Double, previousStock As Double
Dim lastRowBBM As Long, lastRowIsi As Long
MsgBox "Data tersimpan! Stok baru: " & newStock & " liter", vbInformation
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Description, vbCritical
End Sub
'Bersihkan Form
Private Sub ResetForm()
Me.txtTanggal.value = ""
Me.cmUnit.value = ""
Me.lbloperator.Caption = ""
Me.lbljenisalat.Caption = ""
Me.lblmerkalat.Caption = ""
Me.lbltypealat.Caption = ""
Me.cmshift.value = ""
Me.txtisi.value = ""
Me.txtjumlah.value = ""
Me.txtPenanggungJawab.value = ""
'Reset Form
Call ResetForm
End Sub
Private Sub UpdateStokAkhir()
Dim wsBBM As Worksheet
Dim lastRow As Long
Dim lastStock As Double
ErrorHandler:
MsgBox "Error saat mengambil stok: " & Err.Description, vbCritical
End Sub