1. Write a VBA procedure that outputs a range after being selected by the user (one statement will do it).
2. Write a VBA procedure that first asks the user to input some text and then changes the caption of the current window to the text value input by the user.
3. Write a VBA procedure that adds three additional workbooks to the application and 10 additional worksheets to each workbook added. Hint: Use object variables and nested For/Each loops.
4. Write a VBA procedure that deletes all but one worksheet in all workbooks currently open in the Excel application. Again use nested For/Each loops. To turn off prompts to the user, use the DisplayAlerts property of the Application object.
5. Open a workbook with more than one worksheet. Write a procedure that inserts a string in each cell in the range AI:E5 in every worksheet. Make the string a concatenation of the worksheet name and cell address (for example, SheetI:$A$3).
6. Use the Worksheet_Change() event procedure to alter the properties of the Font object (Bold, Size, Color, and so on) after the user enters text into a cell. Use a With/End With code structure.
7. Create a spreadsheet that contains several names in multiple rows and columns. Write a VBA procedure that finds a specific name within a highlighted range on the spreadsheet. Use the Find() method of the Range object and the Worksheet_ SelectionChange() event procedure of the Worksheet object. Refer to the Object Browser or on-line help for syntactic requirements. Then record a macro with a similar function and compare the recorded procedure to your own.
8. Design an algorithm for adding intelligence to the Battlecell program, then implement your algorithm by writing the code that will make the computer a more competitive player. Add your code to a new standard module inserted into the Battlecell project. The initial procedure for simulating intelligence should be called from the ComputerFire() procedure in the Battlecell program. You can remove the SetTargetCell() procedure from the Battlecell program that is used to randomly generate a target for the computer. This is a tough one, so be sure to take plenty of time designing your algorithm before writing any code!
Was this article helpful?