The swan used for the Clarke crest and moto Some graphic suggesting the subject of this page.


About SudokEx

SudokEx is a collection of routines written in Visual Basic for Applications (VBA) and which can be used with Excel to help solve the type of puzzle called Sudoku.

VBA is used only to initialise the spreadsheet cell values and formatting. That accomplished, the VBA macros become redundant and the resultant sheet may be stored in .xlsx format and opened by any spreadsheet application with support for Excel conditional formatting (which currently excludes Numbers).

A single square candidate highlighted automatically.
A single square candidate (8) highlighted automatically

SudokEx will not solve a puzzle automatically. Its main job is to maintain the 'candidates list'. This task is tedious and error-prone when attempted manually. With SudokEx you are then free to concentrate on the more interesting challenge of spotting patterns that may be exploited by the traditional Sudoku solving techniques. SudokEx will, however, highlight 'single square candidates' for you. Some puzzles can be solved using this feature alone. In addition, you can save a puzzle at any stage in your work to allow a speculative solution (AKA a guess) to be tried while retaining the ability to return to the earlier state of play.

Top of page

The script

Your cell-meister is not the first to suppose that Excel and Sudoku were made for each other. They're both about numbers in boxes, yes? Well, having written nothing in VBA script before, I would think that, wouldn't I? Although it isn't the worst language in the world by a long stretch, it sometimes seems to have the simplicity of C++ combined with the elegance of Perl. The performance is also a hoot: two minutes to set up the sheet.

There are indeed some far more impressive implementaions available than SudokEx. Most of those, however, need VBA macros enabled to function at all. That presented here can be understood and extended relatively easily (just not by me; I'm moving on).

Top of page

Tips for using SudokEx.

SudokEx isn't really going to solve puzzles for you; it just handles the 'donkey work' of candidate lists and checking for single square candidates. You aren't even prevented from entering incorrect solutions. If you do so then, somewhere along the line, you will see the candidate list for one of the squares shrink to nothing, and you will have to rethink.

If you need to exclude a candidate then just type '0' over it. To repair the change, copy the formula from a fresh copy of SudokEx. With SudokEx.xlsm you can run the script at any time to return to the puzzle start state on Sheet1. Solution digits may be retracted in the same way.

Not every single candidate square is also a single square candidate, so you should keep an eye open for them yourself. Fortunately they are fairly obvious.

Top of page