Это должно делать то, что вам нужно. Убедитесь, что вы проверили это на копии своей таблицы, прежде чем использовать ее.
Sub double_lookup()
PickUp = ThisWorkbook.Sheets(1).Range("C8").Value
dropoff = ThisWorkbook.Sheets(1).Range("C9").Value
distance = ThisWorkbook.Sheets(1).Range("C18").Value
lastrow = ThisWorkbook.Sheets(2).Cells(ThisWorkbook.Sheets(2).Rows.Count, "A").End(xlUp).Row
Set Rng = ThisWorkbook.Sheets(2).Range("A1:A" & lastrow)
xindex = ""
Count = 1
For Each cell In Rng
If cell.Value = PickUp Then
xindex = Count
Exit For
End If
Count = Count + 1
Next cell
yindex = ""
lastcol = ThisWorkbook.Sheets(2).Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
For i = 1 To lastcol
If ThisWorkbook.Sheets(2).Cells(1, i).Value = dropoff Then
yindex = i
Exit For
End If
Next i
If xindex = "" Or yindex = "" Then
MsgBox ("pickup or dropoff not found in sheet 2")
Else
ThisWorkbook.Sheets(2).Cells(xindex, yindex).Value = distance
End If
End Sub