Function PopulateResults() Dim y As Integer Dim x As Integer Dim noresults As Integer…
- User
Function PopulateResults()
Dim y As Integer Dim x As Integer Dim noresults As Integer Dim resultlocx As Integer Dim resultlocy As Integer
noresults = 21
Range(“U:Az”).Interior.Color = RGB(255, 255, 255) Range(“U16:Az48”).ClearContents
For y = 1 To noresults If Worksheets(“Data”).Cells(y, 3).Value > 0 Then 'Pick result location Select Case y Case 1 resultlocx = 21 resultlocy = 16 Case 2 resultlocx = 27 resultlocy = 16 Case 3 resultlocx = 33 resultlocy = 16 Case 4 resultlocx = 39 resultlocy = 16 Case 5 resultlocx = 45 resultlocy = 16 Case 6 resultlocx = 21 resultlocy = 22 Case 7 resultlocx = 27 resultlocy = 22 Case 8 resultlocx = 33 resultlocy = 22 Case 9 resultlocx = 39 resultlocy = 22 Case 10 resultlocx = 45 resultlocy = 22 Case 11 resultlocx = 21 resultlocy = 28 Case 12 resultlocx = 27 resultlocy = 28 Case 13 resultlocx = 33 resultlocy = 28 Case 14 resultlocx = 39 resultlocy = 28 Case 15 resultlocx = 45 resultlocy = 28 Case 16 resultlocx = 21 resultlocy = 34 Case 17 resultlocx = 27 resultlocy = 34 Case 18 resultlocx = 33 resultlocy = 34 Case 19 resultlocx = 39 resultlocy = 34 Case 20 resultlocx = 45 resultlocy = 34 Case 21 resultlocx = 21 resultlocy = 40 End Select
'Populate results Cells(resultlocy, resultlocx).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value, Worksheets(“Data”).Cells(y, 2).Value).Value If Cells(resultlocy, resultlocx).Value = Cells(11, 21).Value Then Cells(resultlocy, resultlocx).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy, resultlocx).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy, resultlocx + 1).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value, Worksheets(“Data”).Cells(y, 2).Value + 1).Value If Cells(resultlocy, resultlocx + 1).Value = Cells(11, 22).Value Then Cells(resultlocy, resultlocx + 1).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy, resultlocx + 1).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy, resultlocx + 2).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value, Worksheets(“Data”).Cells(y, 2).Value + 2).Value If Cells(resultlocy, resultlocx + 2).Value = Cells(11, 23).Value Then Cells(resultlocy, resultlocx + 2).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy, resultlocx + 2).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy, resultlocx + 3).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value, Worksheets(“Data”).Cells(y, 2).Value + 3).Value If Cells(resultlocy, resultlocx + 3).Value = Cells(11, 24).Value Then Cells(resultlocy, resultlocx + 3).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy, resultlocx + 3).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy, resultlocx + 4).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value, Worksheets(“Data”).Cells(y, 2).Value + 4).Value If Cells(resultlocy, resultlocx + 4).Value = Cells(11, 25).Value Then Cells(resultlocy, resultlocx + 4).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy, resultlocx + 4).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 1, resultlocx).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 1, Worksheets(“Data”).Cells(y, 2).Value).Value If Cells(resultlocy + 1, resultlocx).Value = Cells(12, 21).Value Then Cells(resultlocy + 1, resultlocx).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 1, resultlocx).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 1, resultlocx + 1).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 1, Worksheets(“Data”).Cells(y, 2).Value + 1).Value If Cells(resultlocy + 1, resultlocx + 1).Value = Cells(12, 22).Value Then Cells(resultlocy + 1, resultlocx + 1).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 1, resultlocx + 1).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 1, resultlocx + 2).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 1, Worksheets(“Data”).Cells(y, 2).Value + 2).Value If Cells(resultlocy + 1, resultlocx + 2).Value = Cells(12, 23).Value Then Cells(resultlocy + 1, resultlocx + 2).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 1, resultlocx + 2).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 1, resultlocx + 3).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 1, Worksheets(“Data”).Cells(y, 2).Value + 3).Value If Cells(resultlocy + 1, resultlocx + 3).Value = Cells(12, 24).Value Then Cells(resultlocy + 1, resultlocx + 3).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 1, resultlocx + 3).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 1, resultlocx + 4).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 1, Worksheets(“Data”).Cells(y, 2).Value + 4).Value If Cells(resultlocy + 1, resultlocx + 4).Value = Cells(12, 25).Value Then Cells(resultlocy + 1, resultlocx + 4).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 1, resultlocx + 4).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 2, resultlocx).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 2, Worksheets(“Data”).Cells(y, 2).Value).Value If Cells(resultlocy + 2, resultlocx).Value = Cells(13, 21).Value Then Cells(resultlocy + 2, resultlocx).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 2, resultlocx).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 2, resultlocx + 1).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 2, Worksheets(“Data”).Cells(y, 2).Value + 1).Value If Cells(resultlocy + 2, resultlocx + 1).Value = Cells(13, 22).Value Then Cells(resultlocy + 2, resultlocx + 1).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 2, resultlocx + 1).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 2, resultlocx + 2).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 2, Worksheets(“Data”).Cells(y, 2).Value + 2).Value If Cells(resultlocy + 2, resultlocx + 2).Value = Cells(13, 23).Value Then Cells(resultlocy + 2, resultlocx + 2).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 2, resultlocx + 2).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 2, resultlocx + 3).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 2, Worksheets(“Data”).Cells(y, 2).Value + 3).Value If Cells(resultlocy + 2, resultlocx + 3).Value = Cells(13, 24).Value Then Cells(resultlocy + 2, resultlocx + 3).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 2, resultlocx + 3).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 2, resultlocx + 4).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 2, Worksheets(“Data”).Cells(y, 2).Value + 4).Value If Cells(resultlocy + 2, resultlocx + 4).Value = Cells(13, 25).Value Then Cells(resultlocy + 2, resultlocx + 4).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 2, resultlocx + 4).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 3, resultlocx).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 3, Worksheets(“Data”).Cells(y, 2).Value).Value If Cells(resultlocy + 3, resultlocx).Value = Cells(14, 21).Value Then Cells(resultlocy + 3, resultlocx).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 3, resultlocx).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 3, resultlocx + 1).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 3, Worksheets(“Data”).Cells(y, 2).Value + 1).Value If Cells(resultlocy + 3, resultlocx + 1).Value = Cells(14, 22).Value Then Cells(resultlocy + 3, resultlocx + 1).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 3, resultlocx + 1).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 3, resultlocx + 2).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 3, Worksheets(“Data”).Cells(y, 2).Value + 2).Value If Cells(resultlocy + 3, resultlocx + 2).Value = Cells(14, 23).Value Then Cells(resultlocy + 3, resultlocx + 2).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 3, resultlocx + 2).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 3, resultlocx + 3).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 3, Worksheets(“Data”).Cells(y, 2).Value + 3).Value If Cells(resultlocy + 3, resultlocx + 3).Value = Cells(14, 24).Value Then Cells(resultlocy + 3, resultlocx + 3).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 3, resultlocx + 3).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 3, resultlocx + 4).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 3, Worksheets(“Data”).Cells(y, 2).Value + 4).Value If Cells(resultlocy + 3, resultlocx + 4).Value = Cells(14, 25).Value Then Cells(resultlocy + 3, resultlocx + 4).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 3, resultlocx + 4).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 4, resultlocx).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 4, Worksheets(“Data”).Cells(y, 2).Value).Value If Cells(resultlocy + 4, resultlocx).Value = Cells(15, 21).Value Then Cells(resultlocy + 4, resultlocx).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 4, resultlocx).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 4, resultlocx + 1).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 4, Worksheets(“Data”).Cells(y, 2).Value + 1).Value If Cells(resultlocy + 4, resultlocx + 1).Value = Cells(15, 22).Value Then Cells(resultlocy + 4, resultlocx + 1).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 4, resultlocx + 1).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 4, resultlocx + 2).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 4, Worksheets(“Data”).Cells(y, 2).Value + 2).Value If Cells(resultlocy + 4, resultlocx + 2).Value = Cells(15, 23).Value Then Cells(resultlocy + 4, resultlocx + 2).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 4, resultlocx + 2).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 4, resultlocx + 3).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 4, Worksheets(“Data”).Cells(y, 2).Value + 3).Value If Cells(resultlocy + 4, resultlocx + 3).Value = Cells(15, 24).Value Then Cells(resultlocy + 4, resultlocx + 3).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 4, resultlocx + 3).Interior.Color = RGB(255, 255, 255) End If Cells(resultlocy + 4, resultlocx + 4).Value = Cells(Worksheets(“Data”).Cells(y, 1).Value + 4, Worksheets(“Data”).Cells(y, 2).Value + 4).Value If Cells(resultlocy + 4, resultlocx + 4).Value = Cells(15, 25).Value Then Cells(resultlocy + 4, resultlocx + 4).Interior.Color = RGB(255, 255, 0) Else Cells(resultlocy + 4, resultlocx + 4).Interior.Color = RGB(255, 255, 255) End If complete the code
- Assistant
Next y
End Function