Sub GetCompassDirection(bearing As Double) As String Dim tmp As Int ' Set Default Direction Dim direction As String : direction = "N" tmp = Floor(Round(bearing / 22.5)) Select Case tmp Case 1 direction = "NNE" Case 2 direction = "NE" Case 3 direction = "ENE" Case 4 direction = "E" Case 5 direction = "ESE" Case 6 direction = "SE" Case 7 direction = "SSE" Case 8 direction = "S" Case 9 direction = "SSW" Case 10 direction = "SW" Case 11 direction = "WSW" Case 12 direction = "W" Case 13 direction = "WNW" Case 14 direction = "NW" Case 15 direction = "NNW" Case Else direction = "N" End Select Return direction End Sub
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.