This Microsoft Excel 2007 SELECTING CELLS 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.
A full answer to this exercise is provided as part of the training course!
| 1) | Download the files needed to start this exercise: exercise-904.zip (and click here if you experience any problems unzipping this file after downloading it). |
| 2) | Open the workbook in the folder above (and you may the courseware chapters on selection open too!). |
| 3) | Write a macro which selects all of the destroyers at the same time (use the UNION method, or just use the syntax Range("...","...","...").Select): |
The results of running your macro
|
|
| 4) | Now write a macro which assumes that cell E4 is selected, and relative to this cell selects the battleship. Your macro can do this by selecting the block of cells which begins on the same row as the active cell (ie E4) but 5 columns to the right, and which has 5 rows in it and 1 column. You can use the Resize method for this. |
Your macro should use these cells selected - you can also use the Range method, as described in the manual, but this is harder
|
|
| 5) | Save your file as Battleships macros, 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.
Recommended sites: C# corner | Computer tutorials | Training classes