I'm creating a sub to call a function, but i kept having error from the below code.
VBA Code:
Sub ttimeTEST()
Dim timeA As Date
Dim locnA, locnB As String
locnA = "Singapore"
locnB = "Malaysia"
timeA = TravelTime(locnA, locnB)
Debug.Print (timeA)
End Sub
Private Function TravelTime(ByRef locnA As String, ByRef locnB As String) As Date
Dim ttimeWS As Worksheet
Dim TTTime As Date
Set ttimeWS = ThisWorkbook.Sheets("ttime")
TTTime = Intersect(ttimeWS.Columns(1).Find(locnA).EntireRow, ttimeWS.Rows(1).Find(locnB).EntireColumn).Value
End Function