Any relationship?

Mathers2013

Banned
Banned
The following program prints the relationship between any group of numbers (should there be one):

Code:
[CELLS(1,1)=DATA]

Sub FINDRELATIONSHIP()

A$ = Cells(1, 1)

For B = 1 To Len(A$)

For C = 0 To Len(A$)

For D = 1 To Len(A$)

For E = 0 To Len(A$)

For F = 1 To Len(A$)

    G = (((B + C) * D) - E) / F
    
        If (G = Val(Mid$(A$, B, 1))) Then
        
            H = 0
            
                For I = 1 To Len(A$)
                
                    IF (((I+C)*D)-E)/F=VAL(MID$(A$,I,1))) THEN H=H+1                    

                    IF (H=LEN(A$)) THEN

                     Cells(1, 2) = "+"

                     Cells(1, 3) = "*"

                     Cells(1, 4) = "-"

                     Cells(1, 5) = "/"

                     Cells(2, 1) = "T(TIMES OR X)"

                     Cells(2, 2) = C

                     Cells(2, 3) = D

                     Cells(2, 4) = E
                
                     Cells(2, 5) = F

                     End

                Next I
                
        End If
        
Next F

Next E

Next D

Next C

Next B

End Sub
I do not believe there is a problem with the code (I have tried it with simple relationships such as "12345" or "2468") but there does not appear to be a relastionship between descending numbers such as "54321" or "987654321." I will update the program so the relationship between digits in a phone number can be described and remembered simply with FOUR digits (+*-/). :)
 
Back
Top