Microsoft Excel 2007
Looping over collections exercise
Average difficulty

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: Change the colours of all green cells to red in team strip

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

1) Download the files needed to start this exercise: exercise-916.zip (and click here if you experience any problems unzipping this file after downloading it).
2) The football kit spreadsheet in the workbook above has a serious error in it:
Exercise screen-shot 2023 A clue - the team strip is not red ...
3) Write a macro which loops over all of the cells in the range shown, changing any green cells to the team colour of your choice (please assume that your team has the same colour shirt as socks for the purposes of this example).
4) The method you should use is:
  • Loop through all the cells in the range of cells from B4:L22 (say)
  • For each cell, test whether its Interior.Color property equals 5287936 (which happens to be the shade of green shown)
  • If it does, change it to a colour of your choice (see hint below)
Training exercise hint For this exercise you will need to know that Manchester United play in a shade of red which can be approximated by the colour 192.
5) Save this workbook as Definitely not blue.xlsm, and 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.