Condividi tramite


Experienced Challenge 10: Don't Get Ten of Those Little Red Cells

Office Programs Required

Microsoft Excel 2007

Goldfish Awarded

20

Deadline for Submission

Friday, May 1, 2009 (8:00 AM Pacific Daylight Time)

Files Required

Experienced_challenge_10.xlsm in the OfficePalooza Challenge Pack.

Let’s get this taken care of right away. We’re well aware that Don’t Get Ten of Those Little Red Cells is a terrible name for a game, especially when you consider the fact that the game Challenge 10 is based on already has a perfectly good name: Hangman. So why didn’t we just call Challenge 10 Hangman? Well, without going into detail, it was hard enough to get the name OfficePalooza approved. We didn’t want to press our luck and try for Hangman, too. And once we found out that Hungry, Hungry Hippos had already been used, well, that meant that Don’t Get Ten of Those Little Red Cells was the only name left to us.

But a rose by any other name would smell just as sweet, right? With that in mind, let’s talk about what you need to do to actually solve this challenge. To begin with, you need to grab a copy of the file Experienced_challenge_10.xlsm from the OfficePalooza Challenge Pack . Upon opening that file you should see something like this:

Experienced Challenge 10 

In other words, you have a list of all 26 letters in the English alphabet; you have 10 blank squares used for keeping track of incorrect guesses; you have a big blank space where the game will actually be played; and you have a button labeled New Game which, well, sets up a new game.

So what’s your role in all this? Well, for starters, you’re going to right-click the New Game button, click Assign Macro, and then edit the NewGame macro. To this macro you need to add some Visual Basic for Applications (VBA) code that determines the next word to be used in the game. (Allowed words are found on Sheet2 in the workbook.) And, just to make things interesting, let’s say the word must be at least 7 letters long but no more than 13 letters long.

Because that does make this interesting, doesn’t it?

After you select a word you then need to color in the appropriate number of spaces in row 8. For example, if you have a seven-letter word the spreadsheet will look like this:

Experienced Challenge 10 

Still with us? OK, now you need to create a second subroutine, one that actually lets you play the game. And just how do you play the game? Well, you click on a letter in the Available letters area. (Selected letters should then be grayed out, so they cannot be selected a second time). If the letter selected does not appear in the word then you color in one of the Incorrect Guesses cells. If the letter you selected does appear in the word then you display it in the appropriate spot in row 8. For example, suppose the secret word is bananas and you choose the letter a. The spreadsheet will then look like this:

Experienced Challenge 10 

And so on. If you can guess all the letters in the word before you get 10 red cells then you win. And if you get 10 red cells before you can guess all the letters in the word? Well ….

Submitting Your Entry

The OfficePalooza sweepstakes is over, but you’re welcome to try the challenges and learn on your own. Good luck!