Search for question
Question

12.6 VBA: Loops HW

Create a new macro-enabled workbook and save it as (lastname-firstname]Loops.xlsm.

The two macros in this homework should be assigned to separate buttons and should be located on the same worksheet.

When you are done, upload your saved workbook below.

Be sure to write your code in a module in the workbook you will submit, not in your personal workbooks or sheets. To access the correct module, go to your "Visual Basic,"

right-click "Microsoft Excel Objects" in the workbook you are submitting, and then click "Insert" and "Module.

Problem 1: Write a Sub that prints out (in the cells, not debug window) numbers 1 through 25 In an Excel worksheet using any type of Loop (e.g., Do Until, Do While, For).

Problem 2: Create a nested-loop program (you can use any type of loop you would like).

This nested loop should take the names input (below) and print out every possible combination of first and middle names. These input names will need to appear in your

workbook somewhere. Then, output every possible combination of first and middle names somewhere in the worksheet. Your program should work correctly with more or

less first names and middle names. Below is an example of input and output. To save space, only the names associated with the first two first names are shown in the

example output.

Input

First names Middle names

Penelope Jill

Gwyneth Diane

Alice

Heidi

Anna

Lilly

Victoria

Example Output

Fig: 1