VBA Function that addresses a “Checking for a Sum”

  • Hi there, could you show me how to use excel vba to create a function that “Checking for a Sum” procedure. This function will take as inputs 2 ranges of cells, of any size, that contain only integers, as well as a target integer value. The input ranges of cells, even when they are 2D, should be treated as a simple list of numbers by iterating through the cells. The function should determine whether there is a pair of numbers, where one of the numbers is taken from Input_A, and the other from Input_B, that can be summed to produce the TargetVal. The function should return “Matched!” if such a pair exists, and “No Can Do!” if not.

    Could you show your code as an guide? Thanks !

    An example is provided of what this function should find:

    inPUT A is (4, -5, -12, 3241, 17,2)

    Input b is (11,1,0,1122,3344,37)