Copy this macro. There should be a way to declare the arrays so they can be used in the FOR loops, but I don't remember it at the moment. The macros will list the possibilites starting in cell A2 and go down from there.
Dim ColB, ColC, ColD, ColE, ColF, ColG, ColH As Integer
Dim RwCtr, Ttl, AVal, CntEm, ColAmt(7) As Integer
Dim Strng As String
Sub Factors()
AVal = Range("A1")
RwCtr = 2
For ColB = 0 To AVal
ColAmt(1) = ColB
If NeedMore(1) Then
For ColC = 0 To AVal
ColAmt(2) = ColC
If NeedMore(2) Then
For ColD = 0 To AVal
ColAmt(3) = ColD
If NeedMore(3) Then
For ColE = 0 To AVal
ColAmt(4) = ColE
If NeedMore(4) Then
For ColF = 0 To AVal
ColAmt(5) = ColF
If NeedMore(5) Then
For ColG = 0 To AVal
ColAmt(6) = ColG
If NeedMore(6) Then
For ColH = 0 To AVal
ColAmt(7) = ColH
If Not (NeedMore(7)) Then
ColH = AVal
End If
Next
Else
ColG = AVal
End If
Next
Else
ColF = AVal
End If
Next
Else
ColE = AVal
End If
Next
Else
ColD = AVal
End If
Next
Else
ColC = AVal
End If
Next
Else
ColB = AVal
End If
Next
End Sub
Function NeedMore(EndCol) As Boolean
NeedMore = True
If ColAmt(EndCol) > 0 And Range("A2").Offset(0, EndCol) > 0 Then
Ttl = 0
For CntEm = 1 To EndCol
Ttl = Ttl + ColAmt(CntEm) * Range("A2").Offset(0, CntEm)
Next
If Ttl >= AVal Then
NeedMore = False
End If
If Ttl = AVal Then
Strng = Empty
For CntEm = 1 To EndCol
If ColAmt(CntEm) > 0 And ColAmt(CntEm) <= AVal Then
If Strng <> Empty Then
Strng = Strng & "+"
End If
Strng = Strng & ColAmt(CntEm) & "x" & Chr(65 + CntEm) & "2"
End If
Next
Range("A" & RwCtr) = Strng
RwCtr = RwCtr + 1
End If
End If
End Function