Exercise: Substituting arrows for directions in a maze using autoshapes

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the Wise Owl course listed below!

Category ==> Advanced VBA  (29 exercises)
Topic ==> Working with shapes  (3 exercises)
Level ==> Relatively easy
Course ==> Advanced VBA
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Open the workbook in the above folder.  It contains an all-too-familiar maze.

Red Riding Hood is finding the directions a little hard to follow.  Write a macro which loops over all of the cells in the maze shown shaded:

Maze range

Your macro should check each cell in the range E4:G9.

For each cell, substitute arrows as follows:

Contents of cell Substitute
R Autoshape number 33
L Autoshape number 34
U Autoshape number 35
D Autoshape number 36

The trick, of course, is positioning the arrows so that they look sensible.  Here's what the final maze might look like after running your macro:

Final maze

Much better!


When you've got this working, save the workbook as Putting arrows in maze, then close it down.

This page has 0 threads Add post