VBA USERFOM to Select Burger Options and Output Summary with Total

bjohnsman8

New Member
Joined
May 19, 2016
Messages
7
Hello,
I have a list of ingredients that I would like to develop a user form in VBA to allow the customer to select from a series of ingredients then it calculates the price at the end once you hit Order. Here is a list of the ingredients, I will not include the prices for each as they could be anything really. More specifically I want to assign the macro to a Button to prompt the input of the order in the user form. The follow ingredients sections should be listed with radio buttons. Once selected the user hits submit which calculates the total and gives a summary of the final order.

Meats
Beef
Black Bean
Buffalo Chicken
Grilled Chicken
Soy Burger
Turkey
Veggie Burger

Cheese
American Cheese
Cheddar Cheese
Mozzarella Chees
Pepper Jack

Toppings
Jalapenos
Lettuce
Mushrooms
Onions
Peppers
Pickles
Spinach
Tomato
Bacon

Bread
Gluten Free Bun
Multigrain Bun
Onion Roll
Potato Roll
Ramen Bun
Whole Wheat Bun
 
Ooooh. A LOT of gotchas in here

1: Never use UserForm_Click. One of my pet hates about VBA is that the default event for forms is the Click event. It should be UserForm_Initialize
.............Not your fault, but one that causes a LOT of consternation

2: Get yourself a naming convention and stick to it. Having ComboBoxes named "Meats", "ChsSel" and "BrdSel" is fraught with danger. Maybe not important in this little project, but when you get into thousands of lines of code, you will welcome the use of standardised names, and think "Maybe that hicksi was right and you DO need beetroot on a burger"

3: If you are manually adding items to a ListBox or ComboBox, then it's good practice to clear it first.

4: Comments made by others about 'thinking about the data'. My daughter is NO-DAIRY, so this won't work as you don't have a "No Cheese" option.
... Just for laughs, go watch this https://www.youtube.com/watch?v=hdIXrF34Bz0

5: ComboBoxes indexes are ZERO-to-n. Your test should be "Meats.ListIndex >= 0". Your code might work, but you will get caught some day with that approach.

6: Would you like your user to have a default set? If so, you might like to have Meats.Value="Grilled Chicken" (again, go watch the Five Easy Pieces Youtube)
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,351
Messages
6,124,445
Members
449,160
Latest member
nikijon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top