Microsoft Excel
Looping over collections exercise
Average difficulty

This Microsoft Excel LOOPING OVER COLLECTIONS exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl EXCEL 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: Deleting all but current worksheet

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

1) Create a new workbook, and save this as Deleting Sheets.xls.
2) Within this, create a macro which deletes every worksheet apart from the one you currently have selected.  To do this, you will need to know:
  • That you can always use the word ActiveSheet to refer to the currently selected worksheet; and
  • That every worksheet has a Name property.
Training exercise hint Note that deleting a worksheet will cause a warning message to display.  You can suppress this with the command Application.DisplayAlerts = False.
3) Save and close this workbook.

Thank you for showing an interest in this Excel 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.