Microsoft Visual Basic
Recording macros and buttons exercise
Average difficulty

This Microsoft Visual Basic RECORDING MACROS AND BUTTONS 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: Big Cheese - Recording Absolute Macros

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

1) Download the files needed to start this exercise: exercise-969.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Open the file shown in the folder above.
3) Before you start recording a macro, take a copy of the current sheet so you have a replica to test your macro on later.
4) Record a macro called FormatTable, with the shortcut CTRL + SHIFT + F, which will format the table and add a formula into column C to calculate the ratio of people who prefer each cheese.
5) The final table should look like the below:
Exercise screen-shot 2298 You could also add borders if you wish.
6) The steps involved in this macro are:
  • In Cell C3 add in the header % People.
  • Highlight Columns A-C and centre the text within each column.
  • Align the main header Favourite Cheeses Data across Columns A-C.
  • Change the Font of the main header to Bold and Size 14pt.
  • Change the Font of the table headers in Row 3 to Bold and Size 12pt.
  • In Cell C5 type in a formula to calculate the ratio of the people who prefer that cheese.
  • AutoFill this down to the bottom of the list.
  • AutoSize the column widths.
Training exercise hint Your ratio formula can use the SUM function to find to total number of people surveyed, there is a range name (PeopleNumbers) to help here.
7) Test your macro works whilst on the copy of the cheese sheet you made earlier.
8) Save the amended file as Le Grand Fromage - Formatted 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 copyright Wise Owl Business Solutions Ltd 2008.  All rights reserved..