ugochinyere.okehi 2015-08-18 Calc_Distance_Miles Purpose: Calculates the distance between the two points in miles. Enter the Latitude and Longitude of the first point on the Earth as the first two inputs and enter the Latitude and Longitude of the second point on the Earth. Return Type: Numeric Example:#Calc_Distance_Miles( 29.76429, -95.38370, 39.850017, -104.673915) Output: 872.60 Numeric Option Explicit Function Calc_Distance_Miles(lat1 As Double,lon1 As Double,lat2 As Double,lon2 As Double) As Double calc_distance_miles = ArcCos(Cos(Radians(90-lat1))*Cos(Radians(90-lat2)) + Sin(Radians(90-lat1))*Sin(Radians(90-lat2))*Cos(Radians(lon1-lon2))) * 3958.756 End Function '************************************************ '***Function Name: ArcSin '***Purpose: This function finds the arcsin of the input '************************************************ Function ArcSin(X As Double) As Double ArcSin = Atn(X / Sqr(-X * X + 1)) End Function '************************************************ '***Function Name: ArcCos '***Purpose: This function finds the arcCos of the input '************************************************ Function ArcCos(X As Double) As Double ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1) End Function '************************************************ '***Function Name: Radians '***Purpose: This function finds X in radians '************************************************ Function Radians(X As Double) As Double Radians = X*(3.14159265359/180) End Function Numeric lat1 Latitude for first point Numeric lon1 Longitude for first point Numeric lat2 Latitude for second point Numeric lon2 Longitude for second point