Here is my answer. Why do you need two loops. Some relative addressing does this pretty well. Set up the table, for example:

and your code is just that
Sub Button_Click() Dim dblTolerance As Double Dim tmp As Range 'Get source range Set tmp = ActiveSheet.Range("A2") 'Get tolerance from sheet or change this to an assignment to hard code it dblTolerance = ActiveSheet.Range("D13") 'use the temporary variable to cycle through the first array Do Until tmp.Value = "" 'Use absolute function to determine if you are within tolerance and if so put match in the column 'NOTE: Adjust the column offset (set to 4 here) to match whichever column you want result in If Abs(tmp.Value - tmp.Offset(0, 2).Value) < dblTolerance Then tmp.Offset(0, 4).Value = "Match" Else tmp.Offset(0, 4).Value = "No Match" End If 'Go to the next row Set tmp = tmp.Offset(1, 0) Loop 'Clean up Set tmp = Nothing End Sub
Comments in the code explain how this works. This is superior to the double loop because relative reference is faster, memory usage is more efficient, and you only need to do one pass per line.
If for some reason you need to use a double loop, let me know, but this is worse compared to this methodology. Hope this helps.
source share