Share
Explore BrainMass

Visual Basic for Applications (VBA) for Modelers - excel software 2

Please refer to attached PDF documents for original questions.

2. Create a user form that contains the usual OK and Cancel buttons. It also should contain two sets of option buttons, each set placed inside a frame. The captions on the first set should be Baseball, Basketball, and Football. The captions on the second set should be Watch on TV and Go to games. Then write the event handlers and code in a module so that when the program runs, the user sees the form. If the user makes a couple of choices and clicks OK, he should see a message like, "Your favorite sport is basketball, and you usually watch on TV." If the user clicks Cancel, the message "Sorry you don't want to play." should appear.

3. Repeat the previous exercise, but now make the controls checkboxes, not option buttons. Change the message in case the user clicks OK to something appropriate, such as, "You like baseball and basketball, and you like to watch on TV and go to games." The message should be appropriate, regardless of which checkboxes are checked (including none being checked).

4. Create a user form that contains the usual OK and Cancel buttons. It should also contain a list box of the type where the user is allowed to select only one item from the list. Write a UserForm_Initialize sub that populates the list with the states Illinois, Indiana, Iowa, Michigan, Minnesota, Ohio, Pennsylvania, and Wisconsin (in this order), and selects Indiana by default. Then write the event handlers for the buttons and code in a module so that when the program runs, the user sees the form. If she chooses an item from the list and then clicks on OK, she should see a message such as, "You live in Ohio." If she clicks on Cancel, she should see the message, "You must not live in a Big Ten State."

7. The file Big Ten Teams.xlsx contains the school and mascot names for the Big Ten teams in a range named Teams. (It doesn't include Nebraska yet.) Create a user form that contains the usual OK and Cancel Buttons. It should also contain a list box of the type where the user is allowed to select only one item from the list. Set its RowSource property to Teams, so that the list box is automatically populated from the list in this range. Also, set its ColumnCount property to 2, so that schools and mascots both appear in the list box, and set its ColumnHeads property to True, so that each column has an appropriate heading. Write a UserForm_Initialize sub that selects Indiana by default. Then write the event handlers for the buttons and code in a module so that when the program runs, the user sees the form. If he chooses an item from the list and then clicks on OK, he should see a message such as, ''You must root for the Indiana Hoosiers." If he clicks Cancel, he should see the message, "You must not be a Big Ten fan." (Hint: In online help, look up the BoundColumn property of a list box and how it controls the Value property.)

Attachments

Solution Summary

The expert creates a user form that contains the usual OK and Cancel Buttons for visual basic applications for modelers.

$2.19