I think the only changes needed is how the functions return their values, and declaration of a value. Instead of Return use the function name, eg:
Code:
distance = dist
..and:
Code:
Dim theta As Double 
  theta = lon1 - lon2