Hi. I am a complete beginner. This is the first time I've done code. I know the code is sloppy but I know I can get it to work and will clean it up after finding out this answer.
I am writing a code to convert degrees minutes and seconds to decimal degrees.
My big obstacle right now is that when I compute the minutes it adds a zero to the left of the equation. So, instead of reading "1.234" like it should, it looks like "10.234"
Thanks so much!
Tiffany
CODE
Dim dmsDegrees As Single 'Sets the degrees, minutes and seconds to single variable
Dim dmsminutes As Single
Dim dmsseconds As Single
Dim Acoord As String 'Set to string b/c it is text
Acoord = "-80 33 15"
dmsDegrees = -80 'Gives values to the degrees, minutes and seconds
dmsminutes = 33
dmsseconds = 15
'Sets up an input box for putting in degrees, minutes and seconds
dmsA = InputBox( _
"Enter Degrees", _
"Degrees, Minutes, & Seconds")
Adegrees = (dmsA) 'gives value to the Adegree variable
'Presents the answer to the value inputted in a message box
MsgBox "The Decimal Degrees is: " & Adegrees, _
vbInformation
dmsB = InputBox( _
"Enter Minutes", _
"Degrees, Minutes, & Seconds")
aminutes = (dmsB / 60) 'Computes the minutes data to decimal degree format
MsgBox "The Decimal Degrees is: " & aminutes, _
vbInformation
dmsC = InputBox( _
"Enter Seconds", _
"Degrees, Minutes, & Seconds")
aseconds = (dmsC / 3600) 'Computes the seconds data to decimal degree format
afterdecimal = aminutes + aseconds 'Adds the mintues and seconds
MsgBox "The Decimal Degrees is: " & aseconds, _
vbInformation
msg = dmsA & afterdecimal 'Presents the answer
ans = MsgBox(Acoord & " converts to " & msg)