0% found this document useful (0 votes)
13 views3 pages

Coding Form Bayar

This document contains an Excel VBA tutorial for a payment form that includes functionality for printing receipts, calculating totals, and managing transactions. It defines several subroutines for handling user interactions, updating data, and formatting outputs. Key features include dynamic range selection, tax calculations, and transaction history management.

Uploaded by

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

Coding Form Bayar

This document contains an Excel VBA tutorial for a payment form that includes functionality for printing receipts, calculating totals, and managing transactions. It defines several subroutines for handling user interactions, updating data, and formatting outputs. Key features include dynamic range selection, tax calculations, and transaction history management.

Uploaded by

samashin55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-------------------------------------------------

CODING FORM BAYAR : EXCEL VBA TUTORIAL


-------------------------------------------------
Option Explicit

Private Sub CMDBAYAR_Click()


Dim STRUK, dbtransaksi As Object
Dim DATAMEJA As Object
Dim StartBaris As Long

Set DATAMEJA = [Link]("A5:A1000").Find(What:=[Link],


LookIn:=xlValues)
Set STRUK = [Link]("B1000").End(xlUp)
Set dbtransaksi = [Link]("D1000000").End(xlUp)

Select Case MsgBox("Anda akan mencetak struk" _


& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Cetak Struk")
Case vbNo
Exit Sub
Case vbYes
End Select
Call DynamicRange
[Link](1, 0).PasteSpecial xlPasteAll
StartBaris = [Link]([Link]("B11:B1000")) + 3

[Link](1, 0).PasteSpecial xlPasteAll


Call HapusTransaksi
Call SimpanTanggal

[Link](StartBaris, 0).Value = "Subtotal :"


[Link](StartBaris + 1, 0).Value = "Pajak :"
[Link](StartBaris + 2, 0).Value = "Total Bayar :"
[Link](StartBaris + 3, 0).Value = "Terimakasih Atas Kunjungan Anda"

[Link](StartBaris, 3).Value = CDec([Link])


[Link](StartBaris + 1, 3).Value = Val([Link]) / 100
[Link](StartBaris + 2, 3).Value = CDec([Link])

[Link]("D11:E1000").NumberFormat = "#,##0"
[Link](StartBaris + 1, 3).Style = "Percent"

[Link]
[Link]("B11:E1000").ClearContents
[Link] = ""
[Link] = ""
[Link] = ""
[Link](0, 1).Value = "Ready"
Unload Me
End Sub

Private Sub TXTPAJAK_Change()


On Error Resume Next
Dim DTOTAL As Long
DTOTAL = Val(CDec([Link])) * (Val([Link]) / 100)
[Link] = Format(Val(CDec([Link])) + DTOTAL, "#,###")
End Sub

Private Sub UserForm_Initialize()


[Link] = RGB(49, 55, 94)
[Link] = Now
Call AmbilPesanan
Call HitungTotal
End Sub
Private Sub AmbilPesanan()
Dim DBPESANAN As Long
Dim irow As Long
With ActiveSheet
irow = [Link]("A" & [Link]).End(xlUp).Row
DBPESANAN = [Link]([Link]("A2:A1000"))
If DBPESANAN = 0 Then
[Link] = ""
Else
[Link] = "A2:F" & irow
End If
End With
End Sub

Sub DynamicRange()
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range

Set sht = ActiveSheet


Set StartCell = Range("B2")

LastRow = [Link]([Link], [Link]).End(xlUp).Row


LastColumn = [Link]([Link], [Link]).End(xlToLeft).Column

[Link](StartCell, [Link](LastRow, LastColumn)).Copy

End Sub
Sub HapusTransaksi()
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range

Set sht = ActiveSheet


Set StartCell = Range("A2")

LastRow = [Link]([Link], [Link]).End(xlUp).Row


LastColumn = [Link]([Link], [Link]).End(xlToLeft).Column

[Link](StartCell, [Link](LastRow, LastColumn)).Select


[Link]
End Sub
Sub SimpanTanggal()
Dim x As Integer
For x = 1 To [Link]([Link]("B11:B1000"))
Dim HasilTransaksi As Object
Set HasilTransaksi = [Link]("A800000").End(xlUp)
[Link](1, 0).Value = "=ROW()-ROW($A$5)"
[Link](1, 1).Value = Date
[Link](1, 2).Value = [Link]
Next
End Sub
Private Sub HitungTotal()
Dim MySum As Double
Dim r As Long
MySum = 0
With TABELBAYAR
For r = 0 To .ListCount - 1
MySum = MySum + .List(r, 4)
Next r
End With

[Link] = Format(MySum, "#,###")

End Sub

You might also like