Thanks to your help here at the VB forum I have almost created an excellent accounting tool; unfortunately there are still flaws. Below is the code that I have been working on. For every cell in range “RA” it adds combinations of two cells in Range “RB” until it finds the two that equal the cell in range “RA.” So far it has been about 60% successful at finding all of the combinations of two cells in range “RB” whose sum equals the cells in “RA;” but for reasons unknown to me it does not find all of them. Can someone help me figure out why it misses some and what I can do about it?


VB Code:
  1. Range("e1").Select
  2.     Range(Selection, Selection.End(xlDown)).Select
  3.     Selection.Name = "RB"
  4.    
  5.     Range("f1").Select
  6.     Range(Selection, Selection.End(xlDown)).Select
  7.     Selection.Name = "RA"
  8.    
  9.     Dim RangeA As Range
  10.     Dim RangeB As Range
  11.     Dim CellA As Range
  12.     Dim CellB As Range
  13.     Dim CellC As Range
  14.     Set RangeA = Range("RA")
  15.     Set RangeB = Range("RB")
  16.     For Each CellA In RangeA.Cells
  17.         For Each CellB In RangeB.Cells
  18.             For Each CellC In RangeB.Cells
  19.                 If CellB + CellC = CellA Then
  20.                     CellA.ClearContents
  21.                     CellB.ClearContents
  22.                     CellC.ClearContents
  23.                  End If
  24.             Next CellC
  25.         Next CellB
  26.     Next CellA