MEMBUAT USERFORM INPUT KASIR SEDERHANA
Pastekan pada ComboBox1
Private Sub ComboBox1_Change()
Set PELANGGAN = Sheets("PELANGGAN")
On Error Resume Next 'meski error lanjut terus
Set KunciLook = PELANGGAN.Range("B3",
PELANGGAN.Range("B3").End(xlDown))
Set c = KunciLook.Find(ComboBox1.Value, LookIn:=xlValues,
MatchCase:=False)
TextBox1.Value = c.Offset(0, 1).Value
Dim dDate As Date
dDate = DateSerial(Year(Date), Month(Date), Day(Date))
TextBox6.Value = Format(TextBox6.Value, "dd/mm/yyyy")
dDate = TextBox6.Value
End Sub
Pastekan pada ComboBox2
Private Sub ComboBox2_Change()
Set BARANG = Sheets("PELANGGAN")
On Error Resume Next 'meski error lanjut terus
Set KunciLook = BARANG.Range("D3",
BARANG.Range("D3").End(xlDown))
Set c = KunciLook.Find(ComboBox2.Value, LookIn:=xlValues,
MatchCase:=False)
TextBox2.Value = c.Offset(0, 1).Value
TextBox3.Value = c.Offset(0, 2).Value
End Sub
Pastekan pada CommandButton1
Private Sub
CommandButton1_Click()
'kode input
Dim irow As Long
irow = Worksheets("Sheet1").Cells(Rows.Count,
2).End(xlUp).Offset(1, 1).Row
Worksheets("Sheet1").Cells(irow, 2).Value =
TextBox6.Value
Worksheets("Sheet1").Cells(irow, 3).Value =
ComboBox1.Value
Worksheets("Sheet1").Cells(irow, 4).Value =
TextBox1.Value
Worksheets("Sheet1").Cells(irow, 5).Value =
ComboBox2.Value
Worksheets("Sheet1").Cells(irow, 6).Value =
TextBox2.Value
Worksheets("Sheet1").Cells(irow, 7).Value =
TextBox4.Value
Worksheets("Sheet1").Cells(irow, 8).Value = TextBox3.Value
Worksheets("Sheet1").Cells(irow, 9).Value =
TextBox5.Value
End Sub
Pastekan pada TextBox4
Private Sub TextBox4_Change()
a = Val(TextBox3.Text)
b = Val(TextBox4.Text)
r = a * b
TextBox5.Text = r
End Sub
Pastekan pada TextBox8
Private Sub TextBox8_Change()
a = Val(TextBox5.Text)
b = Val(TextBox8.Text)
r = b - a
TextBox7.Text = r
End Sub
Pastekan pada UserForm
Private Sub
UserForm_Initialize()
ComboBox1.List =
Sheets("PELANGGAN").Range("B3:B25").Value
ComboBox2.List =
Sheets("PELANGGAN").Range("D3:D50").Value
TextBox6.Value =
Sheets("PELANGGAN").Range("a1").Value
TextBox6.Value = Format(TextBox6.Value, "dd/mm/yyyy")
ListBox1.ColumnCount = 9
ListBox1.ColumnWidths = 20 & ";" & 0 &
";" & 0 & ";" & 110 & ";" & 0
& ";" & 110 & ";" & 20 & ";"
& 0 & ";" & 50
ListBox1.RowSource = "DAfTAR"
End Sub
No comments:
Post a Comment