If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] Help with Sudoku code

Hi, I'm coding a sudoku generator in excel for fun and the part of the code that generates the board crashes excel every time I execute. Any idea what I'm doing wrong? I don't think I'm sending it into an infinite loop but I've never used While statements before so I could have overlooked something.

Sub Gen()

Dim x As Integer
Dim i As Integer, j As Integer, k As Integer
Dim M(1 To 9, 1 To 9, 1 To 9) As Integer
Dim r As Integer, c As Integer, b As Integer
Dim Match As Boolean

'reset M
For r = 1 To 9
For c = 1 To 9
For b = 1 To 9
M(r, c, b) = 0
Next
Next
Next

For r = 1 To 9
For c = 1 To 9
b = solveb(r, c)
'solveb returns an integer for which box r*c falls into; code there is accurate/has been tested successfully

Match = False

While (Match = False) 'tests to see if a number (x, which is random 1-9) is already used in the same row, column, or box

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.