VBA Scrabble
Posted on September 15, 2012.
This is a .xlsm file so you need to enable macros! For those using versions prior to Excel 2007, I have programmed it to use the ribbon but the game may still work.
Using Ribbon Buttons

Even though the buttons to start a new game, end your turn, undo tile placement, and swap out your tiles are found on the board, I also included them in the ribbon for convenience.

Playing the Game

The Scrabble board lists the quantity of each letter, score for each letter, the tiles remaining (upper right-hand corner), etc. There are four buttons to click to continue with game play: "New Game", "End Turn", "Undo", and "Swap."

New Game Button

By clicking the "New Game" button, it will clear the board and start a new game. Before clearing the board it will ask how many players you want to play in the game (1-4 players). The user form prevents the user from entering any character except one through four. After entering the number of players then it asks for each player’s name and populates the tiles next to the player’s name.

After starting a new game, the first player takes their turn by highlighting the center cell. By highlighting the cell, a prompt asks the player to enter one of the tiles they currently own. If the player enters an invalid character or a letter they don’t own, then nothing happens. After a player enters a letter it is replaced with a dash (-). See below for user form for entering letters and for changes in the players tile set.

The player can then continue building the rest of the word off the center tile. It will only prompt the user to enter a letter if the player can build there. This game tests all directions and handles tile placement for the first, second, and consecutive tiles.

In the case of a blank tile, the player enters space and it changes to a special tile form (see below). Here the player can enter any letter they want. When the blank tile is placed on the board the letter shows up in red font so that it isn’t scored.

After the player finishes their turn, they click the “End Turn” button. Clicking the “End Turn” button checks the validity of the word(s) added to the board, scores the points earned (factoring in the word and letter multipliers for all word combinations), and advances to the next player’s turn. If the word is invalid (see below), it will undo the tiles and advance to the next player. It displays all the words that are not valid. The valid word check compares against the excel dictionary. If the player uses all seven tiles they will receive an extra 50 points to their score.

Undoing Tile Placement

After a player has placed tiles and they decide against their decision, they can click the “Undo” button and it will erase all the tiles placed, replace all the tiles in the players list, and start the turn over. The player can then begin placing tiles again.

Swapping Tiles

On the occasion that the player receives a bunch of tiles they don’t want or they can’t place anything because of the combination of tiles, the player can choose to swap out one, two…or all the tiles that they currently have if they want. Every letter entered into the form replaces the same letter on the worksheet with a dash. If a player deletes a letter they entered, it is placed back into the spreadsheet. Below is an example of what it looks like when a player decides to swap out tiles.