CODING
CODING
MEMBUAT KODE UNTUK EXPORT GRAFIK MENJADI FILE JPG DAN MENAMPILKAN KE
USERFORM MELALUI MEDIA IMAGE YANG TELAH DIMASUKKAN
GRAFIK1.Parent.Width = 180
GRAFIK1.Parent.Height = 180
Grafik2.Parent.Width = 204
Grafik2.Parent.Height = 150
Grafik3.Parent.Width = 216
Grafik3.Parent.Height = 156
Grafik4.Parent.Width = 216
Grafik4.Parent.Height = 204
FOTO1.Picture = LoadPicture(Gambar1)
FOTO2.Picture = LoadPicture(Gambar2)
FOTO3.Picture = LoadPicture(Gambar3)
FOTO4.Picture = LoadPicture(Gambar4)
End Sub
STEP 2. MEMBUAT KODE UNTUK MEMUNCULKAN NILAI TOTAL PENJUALAN
End Sub
STEP 3. KODE UNTUK USERFORM INITIALIZE (MENGATUR WARNA DAN MENGISI TABEL DATA
DASHBOARD)
Private Sub UserForm_Initialize()
‘HideTitleBar Me
Me.PANELMENU.Height = Me.Height
Me.BackColor = RGB(230, 244, 244)
Me.PANELMENU.BackColor = RGB(14, 114, 60)
Me.PANEL1.BackColor = RGB(169, 210, 153)
Me.PANEL2.BackColor = RGB(255, 255, 255)
Me.PANEL3.BackColor = RGB(255, 255, 255)
Me.PANEL4.BackColor = RGB(255, 255, 255)
Me.PANEL5.BackColor = RGB(255, 255, 255)
Me.CARINAMA.BackColor = RGB(14, 114, 60)
Me.LOGOUT.BackColor = RGB(14, 114, 60)
Me.TABEL1.BackColor = RGB(169, 210, 153)
Me.TABEL1.RowSource = Sheet34.Range("TABELDATA1").Address(external:=True)
‘Me.PANELMENU.Enabled = False
Me.Image4.Visible = False
Me.TXT_NAMA.Visible = False
Me.CARINAMA.Visible = False
Me.LOGOUT.Visible = False
Call HitungData
Call BukaGrafik
End Sub
Private Sub MENU1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU1.BackStyle = fmBackStyleOpaque
Me.MENU1.BackColor = RGB(6, 54, 28)
Me.MENU2.BackStyle = fmBackStyleTransparent
Me.MENU2.BackColor = RGB(14, 114, 60)
Me.MENU3.BackStyle = fmBackStyleTransparent
Me.MENU3.BackColor = RGB(14, 114, 60)
Me.MENU4.BackStyle = fmBackStyleTransparent
Me.MENU4.BackColor = RGB(14, 114, 60)
Me.MENU5.BackStyle = fmBackStyleTransparent
Me.MENU5.BackColor = RGB(14, 114, 60)
End Sub
Private Sub MENU2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU2.BackStyle = fmBackStyleOpaque
Me.MENU2.BackColor = RGB(6, 54, 28)
Me.MENU1.BackStyle = fmBackStyleTransparent
Me.MENU1.BackColor = RGB(14, 114, 60)
Me.MENU3.BackStyle = fmBackStyleTransparent
Me.MENU3.BackColor = RGB(14, 114, 60)
Me.MENU4.BackStyle = fmBackStyleTransparent
Me.MENU4.BackColor = RGB(14, 114, 60)
Me.MENU5.BackStyle = fmBackStyleTransparent
Me.MENU5.BackColor = RGB(14, 114, 60)
End Sub
Private Sub MENU3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU3.BackStyle = fmBackStyleOpaque
Me.MENU3.BackColor = RGB(6, 54, 28)
Me.MENU1.BackStyle = fmBackStyleTransparent
Me.MENU1.BackColor = RGB(14, 114, 60)
Me.MENU2.BackStyle = fmBackStyleTransparent
Me.MENU2.BackColor = RGB(14, 114, 60)
Me.MENU4.BackStyle = fmBackStyleTransparent
Me.MENU4.BackColor = RGB(14, 114, 60)
Me.MENU5.BackStyle = fmBackStyleTransparent
Me.MENU5.BackColor = RGB(14, 114, 60)
End Sub
Private Sub MENU4_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU4.BackStyle = fmBackStyleOpaque
Me.MENU4.BackColor = RGB(6, 54, 28)
Me.MENU1.BackStyle = fmBackStyleTransparent
Me.MENU1.BackColor = RGB(14, 114, 60)
Me.MENU2.BackStyle = fmBackStyleTransparent
Me.MENU2.BackColor = RGB(14, 114, 60)
Me.MENU3.BackStyle = fmBackStyleTransparent
Me.MENU3.BackColor = RGB(14, 114, 60)
Me.MENU5.BackStyle = fmBackStyleTransparent
Me.MENU5.BackColor = RGB(14, 114, 60)
End Sub
Private Sub MENU5_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU5.BackStyle = fmBackStyleOpaque
Me.MENU5.BackColor = RGB(6, 54, 28)
Me.MENU2.BackStyle = fmBackStyleTransparent
Me.MENU2.BackColor = RGB(14, 114, 60)
Me.MENU3.BackStyle = fmBackStyleTransparent
Me.MENU3.BackColor = RGB(14, 114, 60)
Me.MENU4.BackStyle = fmBackStyleTransparent
Me.MENU4.BackColor = RGB(14, 114, 60)
Me.MENU1.BackStyle = fmBackStyleTransparent
Me.MENU1.BackColor = RGB(14, 114, 60)
End Sub
STEP 5. MENGEMBALIKAN KONDISI PANEL MENU UTAMA
Private Sub PANELMENU_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
Me.MENU5.BackStyle = fmBackStyleTransparent
Me.MENU5.BackColor = RGB(14, 114, 60)
Me.MENU2.BackStyle = fmBackStyleTransparent
Me.MENU2.BackColor = RGB(14, 114, 60)
Me.MENU3.BackStyle = fmBackStyleTransparent
Me.MENU3.BackColor = RGB(14, 114, 60)
Me.MENU4.BackStyle = fmBackStyleTransparent
Me.MENU4.BackColor = RGB(14, 114, 60)
Me.MENU1.BackStyle = fmBackStyleTransparent
Me.MENU1.BackColor = RGB(14, 114, 60)
End Sub
STEP 6. LOG IN
Me.Image4.Visible = False
Me.TXT_NAMA.Visible = False
Me.CARINAMA.Visible = False
Me.LOGOUT.Visible = False
End Sub
End Sub
Option Explicit
Option Private Module
‘Letakkan di userform
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
If Button = 1 Then
m_sngDownX = X
m_sngDownY = Y
End If
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single,
ByVal Y As Single)
If Button And 1 Then
Me.Left = Me.Left + (X - m_sngDownX)
Me.Top = Me.Top + (Y - m_sngDownY)
End If
End Sub
Me.BOX1.Value = Sheet2.Range("C2").Value
Set CARIMATERIAL = Sheet5.Range("E4:E10").Find(WHAT:=Me.BOX1.Value, LookIn:=xlValues)
Me.FOTO2.Picture = (CARIMATERIAL.Offset(0, 0).Value)
Me.BOX1.Caption = (CARIMATERIAL.Offset(0, 1).Value)
End Sub
Me.TABEL_PEMAKAIAN.RowSource = Sheet3.Range("TABEL_KEBUTUHAN").Address(exsternal:=True)
Me.TABEL_PEMAKAIAN.ColumnCount = 2
Me.TABEL_PEMAKAIAN.List = Sheets (“DATA_DASHBOARD”).Range(“BC:C5”).Curentregion.value
Sub Grafik()
Dim pshp As Shape
Dim xrg As Range
Dim xcol As Long
Dim grafiklist() As Variant
On Error Resume Next
Application.ScreenUpdating = False
Set panggilgrafik = Sheet3.Range("b2:b10")
For Each cell In panggilgrafik
Filename = cell
Sheet3.Pictures.Insert(Filename).Select
Set pshp = Selection.ShapeRange.Item(1)
If pshp Is Nothing Then GoTo lab
xcoll = cell.Column + 1
Set xrg = Cells(cell.Row, xcol)
With pshp