Hello,
I'm working on creating a cash counter allowing users to count loose coin, rolled coin and loose currency at their site via a VBA userform where the data will then populate either a protected or hidden worksheet, setup as a listobject, stored on a shared drive for the only the office manager (and myself) to maintain. I have the userform partially working and need some help finalizing the project.
Help needed:
4. I cannot figure out how to get the total coin labels for each denomination to sum and display in Label48 (Total Coin) and the total currency labels for each denomination to sum the total currency and display in Label49 (Total Currency). I would then like these two labels to sum their totals and display in Label50 (Total Cash). Also, possibly there is a more efficient way to accomplish what I have so far...
5. I have four commanbuttons on the userform - Commandbutton4 (Calculate) is partially working indicated in #4. Commandbutton1 (Add) is not working and is the button I would like to utilize to validate the userform data and add the userform data into the listobject (table1) on my worksheet. I have tried a few things to no avail. Commandbutton2 (clear) is partially working and is the button I would like to utilize to clear the form. It currently clears the textboxes; however, the label values remain. I would like for the entire userform to reset allowing another user to enter data. I have the commandbutton code below in module1 and I call them from the userform frmCashCount code.
Any help would be appreciated...
I also have a notes textbox txtNotes that I would like the add button to place the data into my listobject as a comment indicator.
Here is my Listobject:
CSI Cash Register Cash Count
<tbody>
[TD="bgcolor: #cacaca, align: center"]4[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ff6600, colspan: 7, align: left"]Total Coin[/TD]
[TD="bgcolor: #0066cc, colspan: 7, align: left"]Total Currency[/TD]
[TD="bgcolor: #008000, colspan: 3, align: left"]Reconcilation[/TD]
[TD="align: center"]Comments[/TD]
[TD="bgcolor: #cacaca, align: center"]5[/TD]
[TD="align: left"]Pennies[/TD]
[TD="align: left"]Nickles[/TD]
[TD="align: left"]Dimes[/TD]
[TD="align: left"]Quarters[/TD]
[TD="align: left"]F ifty[/TD]
[TD="align: left"]Dollar[/TD]
[TD="align: left"]Total Coin[/TD]
[TD="align: left"]Ones[/TD]
[TD="align: left"]Fives[/TD]
[TD="align: left"]Tens[/TD]
[TD="align: left"]Twenties[/TD]
[TD="align: left"]Fifties[/TD]
[TD="align: left"]Hundreds[/TD]
[TD="align: left"]Total Currency[/TD]
[TD="align: left"]Total Cash[/TD]
[TD="align: left"]CSI Cash Reconciliation[/TD]
[TD="align: center"]Total Deposit[/TD]
[TD="align: center"]Notes[/TD]
[TD="bgcolor: #cacaca, align: center"]6[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]######[/TD]
</tbody>
Excel tables to the web >> Excel Jeanie HTML 4
Here is my remaining code:
I'm working on creating a cash counter allowing users to count loose coin, rolled coin and loose currency at their site via a VBA userform where the data will then populate either a protected or hidden worksheet, setup as a listobject, stored on a shared drive for the only the office manager (and myself) to maintain. I have the userform partially working and need some help finalizing the project.
Help needed:
- Autonumber the ID field txtID, which is a textbox on the userform and located in column A of the listobject(table1) on the CSI Cash Register Cash Count worksheet.
- I have the coin (loose and rolled) textboxes calculating correctly with the values being placed in labels and this code is below:
Code:
Private Sub CommandButton4_Click()
Label35.Caption = Val(txtPennies.Text) * 0.01 + Val(txtRollPennies) * 0.5
Cells(1, 3).Value = Label35.Caption
Label35.Caption = VBA.Format(Label35, "Currency")
Label36.Caption = Val(txtNickles.Text) * 0.05 + Val(txtRollNickles) * 2
Cells(1, 3).Value = Label36.Caption
Label36.Caption = VBA.Format(Label36, "Currency")
Label37.Caption = Val(txtDimes.Text) * 0.1 + Val(txtRollDimes) * 5
Cells(1, 3).Value = Label37.Caption
Label37.Caption = VBA.Format(Label37, "Currency")
Label38.Caption = Val(txtQuarters.Text) * 0.25 + Val(txtRollQuarters) * 10
Cells(1, 3).Value = Label38.Caption
Label38.Caption = VBA.Format(Label38, "Currency")
Label39.Caption = Val(txtFiftyCent.Text) * 0.5 + Val(txtRollFiftyCent) * 10
Cells(1, 3).Value = Label39.Caption
Label39.Caption = VBA.Format(Label39, "Currency")
Label40.Caption = Val(txtDollarCoin.Text) * 1 + Val(txtRollDollarCoin) * 25
Cells(1, 3).Value = Label40.Caption
Label40.Caption = VBA.Format(Label40, "Currency")
Label42.Caption = Val(txtOnes.Text) * 1
Cells(1, 3).Value = Label42.Caption
Label42.Caption = VBA.Format(Label42, "Currency")
Label43.Caption = Val(txtFives.Text) * 5
Cells(1, 3).Value = Label43.Caption
Label43.Caption = VBA.Format(Label43, "Currency")
Label44.Caption = Val(txtTens.Text) * 10
Cells(1, 3).Value = Label44.Caption
Label44.Caption = VBA.Format(Label44, "Currency")
Label45.Caption = Val(txtTwenty.Text) * 20
Cells(1, 3).Value = Label45.Caption
Label45.Caption = VBA.Format(Label45, "Currency")
Label46.Caption = Val(txtFifty.Text) * 50
Cells(1, 3).Value = Label46.Caption
Label46.Caption = VBA.Format(Label46, "Currency")
Label47.Caption = Val(txtHundred.Text) * 100
Cells(1, 3).Value = Label47.Caption
Label47.Caption = VBA.Format(Label47, "Currency")
End Sub
4. I cannot figure out how to get the total coin labels for each denomination to sum and display in Label48 (Total Coin) and the total currency labels for each denomination to sum the total currency and display in Label49 (Total Currency). I would then like these two labels to sum their totals and display in Label50 (Total Cash). Also, possibly there is a more efficient way to accomplish what I have so far...
5. I have four commanbuttons on the userform - Commandbutton4 (Calculate) is partially working indicated in #4. Commandbutton1 (Add) is not working and is the button I would like to utilize to validate the userform data and add the userform data into the listobject (table1) on my worksheet. I have tried a few things to no avail. Commandbutton2 (clear) is partially working and is the button I would like to utilize to clear the form. It currently clears the textboxes; however, the label values remain. I would like for the entire userform to reset allowing another user to enter data. I have the commandbutton code below in module1 and I call them from the userform frmCashCount code.
Any help would be appreciated...
Code:
Sub ClearForm()
Dim z As Control
For Each z In frmCashCount.Controls
If TypeName(z) = "TextBox" Then
z.Value = ""
Else
If TypeName(z) = "ComboBox" Then
z.Value = ""
End If
End If
Next z
frmCashCount.Repaint
End Sub
Code:
Sub Add()
Dim i As Integer
Dim nextrow As Integer
On Error Resume Next
'Validate Comboxes
If frmCashCount.Date1.Value = "" Then
frmCashCount.Date1.SetFocus
MsgBox "'Date' is a mandatory field...", vbOKOnly, "Required Field"
Exit Sub
ElseIf frmCashCount.ComboBox1.Value = "" Then
frmCashCount.ComboBox1.SetFocus
MsgBox "'Site' is a mandatory field...", vbOKOnly, "Required Field"
Exit Sub
ElseIf frmCashCount.ComboBox2.Value = "" Then
frmCashCount.ComboBox2.SetFocus
MsgBox "'Staff' is a mandatory field...", vbOKOnly, "Required Field"
Exit Sub
ElseIf frmCashCount.ComboBox3.Value = "" Then
frmCashCount.ComboBox3.SetFocus
MsgBox "'Shift' is a mandatory field...", vbOKOnly, "Required Field"
End If
I also have a notes textbox txtNotes that I would like the add button to place the data into my listobject as a comment indicator.
Here is my Listobject:
CSI Cash Register Cash Count
* | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W |
ID | Date | Site | Staff | Shift | |||||||||||||||||||
MBC | Rachael | Opener | * | * | * | * | * | * | * | * | * | * | * | * | * | * | * | * | * | * |
<tbody>
[TD="bgcolor: #cacaca, align: center"]4[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ffffcc"]*[/TD]
[TD="bgcolor: #ff6600, colspan: 7, align: left"]Total Coin[/TD]
[TD="bgcolor: #0066cc, colspan: 7, align: left"]Total Currency[/TD]
[TD="bgcolor: #008000, colspan: 3, align: left"]Reconcilation[/TD]
[TD="align: center"]Comments[/TD]
[TD="bgcolor: #cacaca, align: center"]5[/TD]
[TD="align: left"]Pennies[/TD]
[TD="align: left"]Nickles[/TD]
[TD="align: left"]Dimes[/TD]
[TD="align: left"]Quarters[/TD]
[TD="align: left"]F ifty[/TD]
[TD="align: left"]Dollar[/TD]
[TD="align: left"]Total Coin[/TD]
[TD="align: left"]Ones[/TD]
[TD="align: left"]Fives[/TD]
[TD="align: left"]Tens[/TD]
[TD="align: left"]Twenties[/TD]
[TD="align: left"]Fifties[/TD]
[TD="align: left"]Hundreds[/TD]
[TD="align: left"]Total Currency[/TD]
[TD="align: left"]Total Cash[/TD]
[TD="align: left"]CSI Cash Reconciliation[/TD]
[TD="align: center"]Total Deposit[/TD]
[TD="align: center"]Notes[/TD]
[TD="bgcolor: #cacaca, align: center"]6[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]######[/TD]
</tbody>
Excel tables to the web >> Excel Jeanie HTML 4
Here is my remaining code:
Code:
Option Explicit
Private Sub combobox3_change()
Select Case ComboBox3.ListIndex
Case 0
Me.txtCSIRecon.Visible = False
Me.Label51.Visible = False
Me.Label52.Visible = False
Me.Label31.Visible = False
Case 1
Me.txtCSIRecon.Visible = True
Me.Label51.Visible = True
Me.Label52.Visible = True
Me.Label31.Visible = True
End Select
End Sub
Private Sub Userform_Initialize()
Me.Label53.Caption = Date
ComboBox1.SetFocus
With ComboBox1
.AddItem "FHCIC"
.AddItem "GO"
.AddItem "MBC"
.AddItem "WHBC"
End With
With ComboBox3
.AddItem "Opener"
.AddItem "Closer"
End With
End Sub
Private Sub combobox1_change()
Dim index As Integer
index = ComboBox1.ListIndex
ComboBox2.Clear
Select Case index
Case Is = 0
With ComboBox2
.AddItem "Lyndsay"
.AddItem "Nic"
.AddItem "Rob"
.AddItem "Celine"
.AddItem "Dawn"
.AddItem "Doug"
.AddItem "Jason"
.AddItem "Jen"
.AddItem "Kim"
.AddItem "Meggan"
.AddItem "Nancy"
.AddItem "Rachael"
.AddItem "Sarah"
End With
Case Is = 1
With ComboBox2
.AddItem "Doug"
.AddItem "Kim"
.AddItem "Nancy"
.AddItem "Rob"
.AddItem "Sarah"
.AddItem "Celine"
.AddItem "Dawn"
.AddItem "Doug"
.AddItem "Jason"
.AddItem "Jen"
.AddItem "Kim"
.AddItem "Meggan"
.AddItem "Nic"
.AddItem "Rachael"
End With
Case Is = 2
With ComboBox2
.AddItem "Celine"
.AddItem "Jason"
.AddItem "Rachael"
.AddItem "Dawn"
.AddItem "Doug"
.AddItem "Jen"
.AddItem "Kim"
.AddItem "Lyndsay"
.AddItem "Meggan"
.AddItem "Nancy"
.AddItem "Nic"
.AddItem "Rob"
.AddItem "Sarah"
End With
Case Is = 3
With ComboBox2
.AddItem "Dawn"
.AddItem "Jen"
.AddItem "Meggan"
.AddItem "Celine"
.AddItem "Doug"
.AddItem "Jason"
.AddItem "Kim"
.AddItem "Lyndsay"
.AddItem "Nancy"
.AddItem "Nic"
.AddItem "Rob"
.AddItem "Sarah"
.AddItem "Rachael"
End With
End Select
End Sub
'Private Sub TextBox1_Change()
'GetData
'End Sub
Private Sub CommandButton1_Click()
Add
End Sub
Private Sub CommandButton2_Click()
ClearForm
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub