Sub test2()
Dim aVals As Variant, aCount As Long
Dim bVals As Variant, bCount As Long
Dim targetVal As Double, rngResult As Range
Dim arrResult() As Double, Pointer As Long
Dim i As Long, j As Long
With Sheet1.Range("A:A")
With Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
.Sort key1:=.Cells(1, 1), order1:=xlAscending, Header:=xlNo
aVals = .Value
aCount = .Cells.Count
End With
End With
With Sheet1.Range("B:B")
With Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
.Sort key1:=.Cells(1, 1), order1:=xlAscending, Header:=xlNo
bVals = .Value
bCount = .Cells.Count
End With
End With
targetVal = Range("C1").Value
Set rngResult = Range("E1")
ReDim arrResult(1 To aCount * bCount, 1 To 2)
For i = 1 To aCount
For j = 1 To bCount
If aVals(i, 1) + bVals(j, 1) = targetVal Then
Pointer = Pointer + 1
arrResult(Pointer, 1) = aVals(i, 1)
arrResult(Pointer, 2) = bVals(j, 1)
ElseIf targetVal < aVals(i, 1) + bVals(j, 1) Then
Exit For
End If
Next j
Next i
With rngResult
.Resize(1, 2).EntireColumn.ClearContents
.Resize(Pointer, 2) = arrResult
End With
End Sub