I used to run a daily raffle where customers would buy numbers for $5.00 and my old code kept a running total less 5%. I changed the format of the raffle to weekly with different amounts less 5%. I now charge $2 for one ticket, $5 for three tickets, and $10 for ten tickets. But for the life of me I can't get my vba code to keep a running total. any direction would be greatly appreciated here is the code
Sub cmdEnter_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Dim Running_Total As Currency
Dim Amount_Paid As Integer
Dim i As Integer
Amount_Paid = Me.txtAmount_Paid.Value
'Running_Total = Me.txtRunning_Total.Value
'Populate the players list and assign a unique ticket number for each player
For i = 1 To Amount_Paid
Me.txtRunning_Total = Format(Running_Total, "Standard")
Running_Total = Me.txtRunning_Total.Value
Me.txtTicket_Number = txtTicket_Number.Value + 1
Me.txtPlayers_Name.Value = txtPlayers_Name.Value
Me.txtPlayers_Name.SetFocus
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 1).Row
ws.Cells(lRow, 1) = Me.txtTicket_Number.Text
ws.Cells(lRow, 2) = Me.txtPlayers_Name.Text
Next i
If Amount_Paid = 10 Then
Me.txtRunning_Total.Value = 10 * 0.95
Running_Total = Me.txtRunning_Total.Value
End If
If Amount_Paid = 3 Then
Me.txtRunning_Total.Value = 5 * 0.95
Running_Total = Me.txtRunning_Total.Value
End If
If Amount_Paid = 1 Then
Me.txtRunning_Total.Value = 2 * 0.95
Running_Total = Me.txtRunning_Total.Value
End If
'Running_Total = Me.txtRunning_Total.Value
'Clear the data
Me.txtPlayers_Name.Value = ""
Me.txtAmount_Paid.Value = ""
End Sub
Bookmarks