Whenever I run this code it selects the code (highlighted) and says 'Next without for'. I cant work out whats wrong...:
For y = 1 To 3
For x = 1 To 3
noofposs = 0
For pos = 1 To 9
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(10) = 0 Then
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(pos) = 0 Then
noofposs = noofposs + 1
If noofposs > maxposs Then maxposs = noofposs
If noofposs > maxposs Then xwithmost = x
If noofposs > maxposs Then ywithmost = y
Next pos
Next x
Next y
For y = 1 To 3
For x = 1 To 3
noofposs = 0
For pos = 1 To 9
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(10) = 0 Then
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(pos) = 0 Then
noofposs = noofposs + 1
If noofposs > maxposs Then maxposs = noofposs
If noofposs > maxposs Then xwithmost = x
If noofposs > maxposs Then ywithmost = y
Next pos
Next x
Next y
