Lampiran3 : Coding List
Form 1
‘untuk menambah data mesin
Private Sub CommandButton1_Click() Dim lastkal
Dim bulan
Range("a10000").Select
ActiveCell.End(xlUp).Offset(1, 0).Select ActiveCell.Value = "=ROW()-3"
ActiveCell.Value = "" & ActiveCell.Value garis_Tabel
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox1.Text 'nomesin garis_Tabel
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox2.Text 'namamesin garis_Tabel
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox3.Text 'kalibrasi garis_Tabel
bulan = ActiveCell.AddressLocal ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox4.Text 'lastkalibrasi garis_Tabel
lastkal = ActiveCell.AddressLocal ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaArray = "=EDATE(" & lastkal & "," & bulan & ")" garis_Tabel
CommandButton2_Click End Sub
‘untuk menghapus data
Private Sub CommandButton2_Click() TextBox1.Text = ""
TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" End Sub
‘untukmelakukan pembatalan pengisian data mesin Private Sub CommandButton3_Click()
Unload Me End Sub
Private Sub TextBox4_Change() End Sub
Private Sub TextBox4_Enter() Calendar1.Visible = True Calendar1.SetFocus End Sub
Private Sub UserForm_Click() End Sub
Form 2
Private Sub CommandButton1_Click() Dim namamesin nomesin = TextBox1.Text tglkal = CDate(TextBox2.Text) Columns("B:B").Select
Cells.Find(what:=nomesin, after:=ActiveCell, LookIn:=xlValues, lookat:= _ xlPart, searchorder:=xlByColumns, searchdirection:=xlNext, MatchCase:=False, searchformat:=False).Activate
ActiveCell.Offset(0, 1).Select kalibrasi = ActiveCell.Value ActiveCell.Offset(0, 1).Select tglSblm = ActiveCell.Value ActiveCell.Value = tglkal 'memasukan data
Sheets("DaftarKalibrasi").Select Range("B2").Select
ActiveCell.End(xlDown).Select If (ActiveCell.Row >= 1048576) Then Range("B3").Select
Else
ActiveCell.Offset(1, 0).Select End If
selkiri = ActiveCell.AddressLocal ActiveCell.Value = nomesin ActiveCell.Offset(0, 1).Select ActiveCell.Value = namamesin ActiveCell.Offset(0, 1).Select ActiveCell.Value = kalibrasi ActiveCell.Offset(0, 1).Select ActiveCell.Value = tglkal ActiveCell.Offset(0, 1).Select ActiveCell.Value = tglSblm
selkanan = ActiveCell.AddressLocal
Range(selkiri & ":" & selkanan).Borders(xlEdgeBottom).LineStyle = xlcontinous Range(selkiri & ":" & selkanan).Borders(xlEdgeBottom).ColorIndex = xlAutomatic Range(selkiri & ":" & selkanan).Borders(xlEdgeBottom).TintAndShade = all Range(selkiri & ":" & selkanan).Borders(xlEdgeBottom).Weight = xlMedium Range(selkiri & ":" & selkanan).Borders(xlDiagonalDown).LineStyle = xlNone Range(selkiri & ":" & selkanan).Borders(xlDiagonalUp).LineStyle = xlNone Range(selkiri & ":" & selkanan).Borders(xlEdgeLeft).Weight = xlThin Range(selkiri & ":" & selkanan).Borders(xlEdgeTop).Weight = xlThin Range(selkiri & ":" & selkanan).Borders(xlEdgeRight).Weight = xlThin Range(selkiri & ":" & selkanan).Borders(xlInsideVertical).Weight = xlThin Range(selkiri & ":" & selkanan).Borders(xlInsideHorizontal).Weight = xlThin End Sub
Module1
‘untuk memunculkan form 1 dan 2 Sub tambah()
' Pencatatan_Kalibrasi Macro '
'
UserForm2.Show End Sub
Module2
Public Sub Check_tgl_Kalibrasi() Call hapus_monitor
Call hapus_Layar Dim noMes As String Dim naMes
Dim kaL Dim laSt Dim laNjut Dim selisiH
Dim blokKiri, blokKanan
Dim totalMesinYangHarusDikalibrasi As Integer totalMesinYangHarusDikalibrasi = 0
Sheets("DaftarMesin").Select Range("a4").Select
naMes = ActiveCell.Value ActiveCell.Offset(0, 1).Select kaL = Val(ActiveCell.Value) ActiveCell.Offset(0, 1).Select laSt = ActiveCell.Value ActiveCell.Offset(0, 1).Select laNjut = ActiveCell.Value ActiveCell.Offset(0, 1).Select selisiH = Val(ActiveCell.Value) blokKanan = ActiveCell.AddressLocal ActiveCell.Offset(0, -6).Select blokKiri = ActiveCell.AddressLocal 'blok baris tersebut dengan warna nofill Range(blokKiri & ":" & blokKanan).Select With Selection.Interior
.Pattern = xlNone 'blokbaris tersebut dengan warnakuning Range(blokKiri & ":" & blokKanan).Select With Selection.Interior
.Pattern = xlSolid
Sheets("Monitor1").Select Range("A1").Select
ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = noMes garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = naMes garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = kaL
garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = laSt garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = laNjut garis_Tabel
totalMesinYangHarusDikalibrasi = totalMesinYangHarusDikalibrasi + 1 ElseIf (selisiH <= 4) And (kaL <= 12) Then
'blok.baris.tersebut.dengan.warna.merah Range(blokKiri & ":" & blokKanan).Select With Selection.Interior
.Pattern = xlSolid
Sheets("Monitor2").Select Range("A1").Select
ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = noMes garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = naMes garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = kaL
garis_Tabel
ActiveCell.Offset(0, 1).Select ActiveCell.Value = laSt garis_Tabel
ActiveCell.Value = laNjut garis_Tabel
totalMesinYangHarusDikalibrasi = totalMesinYangHarusDikalibrasi + 1 End If
Sheets("DaftarMesin").Select ActiveCell.Offset(1, 0).Select Loop
MsgBox ("Total mesin yang harus dikalibrasi adalah " & totalMesinYangHarusDikalibrasi) End Sub
Public Sub garis_Tabel()
Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous
.ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous 'hapus isi mmonitor1 Sheets("Monitor1").Select Range("a1:e60000").Select Selection.Delete Shift:=xlToLeft 'beri judul
Range("A1").Value = "Monitor 1" Range("D1").Value = "Up to 2 Week" Range("a2").Value = "No Mesin" Range("B2").Value = "Nama Mesin" Range("c2").Value = "Kalibrasi" Range("d2").Value = "LastCalibrasi" Range("e2").Value = "NextCalibrasi" Range("a1:e2").Font.Bold = True 'edit font
Range("a1:e60000").Font.Name = "Times New Roman" Range("a1:e60000").Font.Size = 10
Range("a1:e60000").HorizontalAlignment = xlLeft Range("A2:E2").Select
With Selection.Interior .Pattern = xlSolid
.PatternColorIndex = xlAutomatic .Color = 65535
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous
.ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous 'hapus isi mmonitor2 Sheets("Monitor2").Select Range("a1:e60000").Select Selection.Delete Shift:=xlToLeft 'beri judul
Range("A1").Value = "Monitor 2" Range("D1").Value = "Up to 1 Month" Range("a2").Value = "No Mesin" Range("B2").Value = "Nama Mesin" Range("c2").Value = "Kalibrasi" Range("d2").Value = "LastCalibrasi" Range("e2").Value = "NextCalibrasi" Range("a1:e2").Font.Bold = True 'edit font
Range("a1:e60000").Font.Name = "Times New Roman" Range("a1:e60000").Font.Size = 10
Range("a2:e2").Interior.Color = RGB(255, 0, 0) Range("a1:e60000").HorizontalAlignment = xlLeft Range("A2:E2").Select
With Selection.Interior .Pattern = xlSolid
Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
.LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0
.TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous
.ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With
With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous
.ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With