|I have developed a simple form with only meats on it, you can select which meats you want and hit the calculate button and it will give you the price.|
I had to use another sheet to itemize the product and cost as per below
A B C D
1 Meats Cost Cheese Cost
2 Beef £5 American Cheese £1
3 Black Bean £2 Cheddar Cheese £2
4 Buffalo Chicken £15 Mozzarella Chees £4
5 Grilled Chicken £15 Pepper Jack £5
6 Soy Burger £1
7 Turkey £22
8 Veggie Burger £10
I would personally split the catagories into different frames on your form, that way you can run the code which will take the values from each checkbox within each frame and check against the relevant list within the sheet and get the associated cost.
I cannot upload the file here so send me a PM with you email address and I can send it through, alternatively you will need to do the following
Insert a form - name it 'frmorder'
place a frame on the form - name it 'Fram1'
Place 7 checkboxes within the frame - named 'Checkbox1' - 'Checkbox7'
Place a command button on the form - named 'CommandButton1'
Place a label on the form - named 'Label1'
Paste the following code within the forms module
Dim SaleCost As Currency
Private Sub UserForm_Activate()
i = 0
SaleCost = 0
For Each bcell In Sheets("Sheet2").Range("A2", Range("A" & Rows.Count).End(xlUp))
FrmOrder.Frame1.Controls(i).Caption = bcell
i = i + 1
Private Sub CommandButton1_Click()
SaleCost = 0
For i = 0 To FrmOrder.Frame1.Controls.Count - 1
If FrmOrder.Frame1.Controls(i).Value = True Then
For Each bcell In Sheets("Sheet2").Range("A2", Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp))
If bcell.Value = FrmOrder.Frame1.Controls(i).Caption Then
SaleCost = SaleCost + bcell.Offset(0, 1)
Label1.Caption = "This sale: " & Format(SaleCost, "currency")
message edited by AlwaysWillingToLearn