You need to turn the computer off and think about how to solve the problem before you confuse yourself with any more code. There is too much of it.
Here are some hints.A 3x3 grid can be solved by placing the numbers 1 through 9 in it in any order.
So long as there are no duplicates and the grid is completely filled, it is solved.
A specific row of the 3x3 grid can have up to six numbers excluded from it.
Likewise with a column.
Each one of those hints suggests a function to test a given number:Is the number already in the 3x3 grid or not?
Is the number already in the 9x1 row or not?
Is the number already in the 1x9 column or not?
Don't if..else every possible combination. There are too many. Use your procedures in an algorithm to test numbers until you can find a valid match or potential match.
I suspect your teacher will expect you to use some recursion to solve this problem. (If you are just doing this on your own, then I suggest you use some recursion to solve this problem.)
Hope this helps.