So I'm writing this code which determines the number based on values of a, b, and c. I figured a nested for loop was the best approach where there are 10 possible selections for a, 2 for b and 3 for c giving a total number of 60 combinations. When I try to run this though it gives me this:"Complie error: next without for" and highlights the first Next on line 14. From what I can tell, that Next does have a For connected to it but maybe I'm missing something. Any advice or corrections would be appreciated.
Below is the code, but on here the for's and next's don't line up as they do in my actual code in VBA.
'Determines what number corresponds to the user's selections' Sub numberdetermine() Dim number As Integer, a As Integer, b As Integer, c As Integer a = Range("AB36").Value b = Range("AB37").Value c = Range("AB38").Value number = 0 For i = 1 To 10 For j = 1 To 2 For k = 1 To 3 number = number + 1 If i = a And j = b And k = c Then Exit For Next k Next j Next i Range("H8").Value = number Range("H20").Value = number + 1 Range("H32").Value = number + 2 End Sub