Sub LotteryCheckSum()
Dim Cell As Range, NumRng As Range, Num1 As Integer, Num2 As Integer, Num3 As Integer, Num4 As Integer, Num5 As Integer
Set NumRng = Range("G12:" & Cells(Rows.Count, "G").End(xlUp).Address(0, 0))
For Each Cell In NumRng
Num1 = Split(Cell.Value, "-")(0)
Num2 = Split(Cell.Value, "-")(1)
Num3 = Split(Cell.Value, "-")(2)
Num4 = Split(Cell.Value, "-")(3)
Num5 = Split(Cell.Value, "-")(4)
If Num3 <> Num1 + Num2 Then
If Num4 <> Num1 + Num2 Then
If Num4 <> Num2 + Num3 Then
If Num4 <> Num1 + Num3 Then
If Num5 <> Num3 + Num1 Then
If Num5 <> Num3 + Num2 Then
If Num5 <> Num3 + Num4 Then
If Num5 <> Num2 + Num1 Then
If Num5 <> Num2 + Num4 Then
If Num5 <> Num1 + Num4 Then
If Num4 <> Num1 + Num2 + Num3 Then
If Num5 <> Num1 + Num2 + Num3 Then
If Num5 <> Num2 + Num3 + Num4 Then
If Num5 <> Num1 + Num4 + Num3 Then
If Num5 <> Num1 + Num2 + Num4 Then
Cell.Offset(0, 21).Value = "0D, <-- Because, no 2 or 3 digit make a Sum of 1 Digit"
Else
Cell.Offset(0, 21).Value = "3D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "3D, <-- Because, Digit Sum " & Num1 & "+" & Num3 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "3D, <-- Because, Digit Sum " & Num2 & "+" & Num3 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "3D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & "+" & Num3 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "3D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & "+" & Num3 & " is equal to Digit " & Num4
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num2 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num3 & "+" & Num4 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num2 & "+" & Num3 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num3 & " is equal to Digit " & Num5
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num3 & " is equal to Digit " & Num4
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num2 & "+" & Num3 & " is equal to Digit " & Num4
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & " is equal to Digit " & Num4
End If
Else
Cell.Offset(0, 21).Value = "2D, <-- Because, Digit Sum " & Num1 & "+" & Num2 & " is equal to Digit " & Num3
End If
Next
End Sub
I'll try to find a solution to the reason thing soon.
Bookmarks