I'm trying to write a subroutine in VB-EXCEL that will return a range containing all the possible numbers for a cell in a Sudoku puzzle. It starts by filling a 1 x 9 range with values of 1 - 9. then loops through the appropriate row in the puzzle, searching for numbers. When it finds one, its value is removed from the 1 x 9 range, eventually leaving only valid, or possible, numbers. The problem is when I run the subroutine I get a Type Missmatch error, or an error having a red dot with a cross in it and the number "400". The errors come from the following proceedure:

For n = 1 To 9 ' figures out what values are potential winners
x = Cells(y, n).Value
If (x > 0) Then
Cells(11, x) = 0
End If
Next n

It looks so simple - am I missing something basic?

Appreciate any suggestions

11 Years
Discussion Span
Last Post by Danny.VBT

What is the exact error you are getting? And what line number is it pointing to. I'm not familiar with VB-EXCEL. Also, what is Cells()?

Should: Cells(11, x) = 0 Be Cells(11, x).Value = 0 ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.