Microsoft Excel 2007
Looping over collections exercise
Harder than average exercise

This Microsoft Excel 2007 LOOPING OVER COLLECTIONS exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl EXCEL 2007 VISUAL BASIC course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Long macro to find the last cell on each sheet and report

A full answer to this exercise is provided as part of the training course!

1) Download the files needed to start this exercise: exercise-918.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Insert a worksheet called Last Cities in the workbook in the above folder.
Training exercise hint This is a longer exercise!
3) Create a macro which lists out the last capital city in each continent worksheet in the separate Last Cities worksheet.  This is what you should see when you run your macro:
Exercise screen-shot 2027 Corresponding to Wales, Zimbabwe, Yemen, United States, Vanuatu and Venezuela
4) To work, your macro should:
  • Go to each worksheet in turn (as long as its names is not Last Cities)
  • Go to the bottom country in this worksheet;
  • Store the name of the capital city in the cell to the right of this country in a string variable;
  • Go to the Last Cities worksheet;
  • Transfer the variable's value into the current cell; then
  • Go down one cell
Training exercise hint You are strongly advised to write the algorithm you will use on a piece of paper before putting finger to keyboard!
5) Save the workbook as Final Cities.xlsm, then close it down.

Thank you for showing an interest in this Excel 2007 Visual Basic training course! As mentioned above, full answers to this and other exercises are provided on the course. On all Wise Owl scheduled courses delegates can take away these model answers (together with their own efforts!) on a free USB stick.

All content � Wise Owl Business Solutions Ltd 2007.  All rights reserved.  Design by Branches.