0% found this document useful (0 votes)
57 views4 pages

Coding Module Proses

The document contains code for processing transactions in Excel VBA. It includes subroutines for adding a new transaction, updating stock quantities after a transaction, printing receipts, clearing transaction fields to start a new transaction, and sorting transactions and inventory items. Data is pulled from and written to different sheets to complete transactions and update records.

Uploaded by

Eliana Putri N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views4 pages

Coding Module Proses

The document contains code for processing transactions in Excel VBA. It includes subroutines for adding a new transaction, updating stock quantities after a transaction, printing receipts, clearing transaction fields to start a new transaction, and sorting transactions and inventory items. Data is pulled from and written to different sheets to complete transactions and update records.

Uploaded by

Eliana Putri N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CODING MODULE PROSES

Sub Transaksi()

On Error GoTo ExcelVba

Dim DataTransaksi As Object

If Sheet1.Range("F5").Value <> "" Then

Set DataTransaksi = Sheet1.Range("D10000").End(xlUp)

Set CARIBARANG = Sheet2.Range("B4:B10000").Find(What:=Sheet1.Range("F5").Value,


LookIn:=xlValues)

DataTransaksi.Offset(1, 0).Value = Sheet1.Range("F5").Value

DataTransaksi.Offset(1, 1).Value = Date

DataTransaksi.Offset(1, 2).Value = CARIBARANG.Offset(0, 1).Value

DataTransaksi.Offset(1, 3).Value = CARIBARANG.Offset(0, 2).Value

DataTransaksi.Offset(1, 4).Value = CARIBARANG.Offset(0, 5).Value

DataTransaksi.Offset(1, 5).Value = CARIBARANG.Offset(0, 3).Value

DataTransaksi.Offset(1, 6).Value = 1

DataTransaksi.Offset(1, 7).Value = 0

Sheet1.Range("F5").Select

Else

Exit Sub

End If

Exit Sub

ExcelVba:

Call MsgBox("Maaf, data barang belum terdaftar", vbInformation, "Data Barang")

End Sub

Sub UpdateStok()

Dim x As Integer

For x = 1 To WorksheetFunction.CountA(Sheet1.Range("D8:D10000"))

Sheet1.Range("A26").Value = Sheet1.Range("A26").Value + 1
Set CariStok = Sheet2.Range("B4:B10000").Find(What:=Sheet1.Range("A27").Value,
LookIn:=xlValues)

CariStok.Offset(0, 3).Value = CariStok.Offset(0, 3).Value - Sheet1.Range("A28").Value

Next

End Sub

Sub CETAKSTRUK()

Application.ScreenUpdating = False

Dim HasilTransaksi As Object

Set HasilTransaksi = Sheet4.Range("A800000").End(xlUp)

If Sheet1.Range("J3").Value = "" Then

Call MsgBox("Lakukan pembayaran terlebih dahulu", vbInformation, "Cetak Struk")

Else

Sheet1.Range("DATATRANSAKSI").Copy

Sheet4.Select

HasilTransaksi.Offset(1, 0).Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Application.CutCopyMode = False

Sheet1.Range("A26").ClearContents

Call UpdateStok

Select Case MsgBox("Struk akan dicetak !" _

& vbCrLf & "Lanjutkan mencetak?" _

, vbYesNo Or vbQuestion Or vbDefaultButton1, "Cetak Struk")

Case vbNo

Sheet1.Range("D8:I1000").ClearContents

Exit Sub

Case vbYes
End Select

Sheet3.PrintOut

Call MsgBox("Struk telah dicetak", vbInformation, "Cetak Struk")

Sheet1.Range("D8:K1000").ClearContents

Sheet1.Range("A26").ClearContents

End If

Sheet1.Select

Sheet1.Range("F5").Select

Sheet1.Range("F5").ClearContents

Sheet1.Range("J3:L3").ClearContents

End Sub

Sub HapusBarang()

Selection.ClearContents

Call UrutTransaksi

End Sub

Sub UrutTransaksi()

Sheet1.Range("D8:K20000").Sort KEY1:=Range("D8"), Order1:=xlAscending, Header:=xlYes

End Sub

Sub UrutBarang()

Application.ScreenUpdating = False

Sheet2.Select

Sheet2.Range("B3:G20000").Sort KEY1:=Range("B3"), Order1:=xlAscending, Header:=xlYes

Sheet1.Select

End Sub

Sub TransaksiBaru()

Select Case MsgBox("Transaksi baru akan dibuat" _

& vbCrLf & "Apakah anda yakin?" _

, vbYesNo Or vbQuestion Or vbDefaultButton1, "Transaksi Baru")


Case vbNo

Exit Sub

Case vbYes

End Select

On Error Resume Next

Sheet1.Range("HapusTransaksi").ClearContents

Sheet1.Range("F5").Select

Sheet1.Range("F5").ClearContents

Sheet1.Range("J3:L3").ClearContents

End Sub

You might also like