codificacion de grados sexagesimales

Download Codificacion de Grados Sexagesimales

If you can't read please download the document

Upload: miguelangelarenas

Post on 17-Dec-2015

232 views

Category:

Documents


9 download

DESCRIPTION

c

TRANSCRIPT

CONVERSION DE GRADOS, MINUTOS, SEGUNDOS A GRADOS DECIMALESEl siguiente de Visual Basic para Aplicaciones de Microsoft personalizado la funcin acepta una cadena de texto de grados, minutos y segundos en formato en el mismo formato exacto que devuelve la funcin Convert_Degree (por ejemplo, 10 27' 36 ") y lo convierte en un ngulo como un valor decimal. Esto es exactamente el inverso de la funcin personalizada Convert_Degree.Advertencia: esta funcin personalizada se produce un error si no est en el argumento Degree_Deg el siguiente formato ' " incluso si el valor de segundos es 0. COPIAR ESTE TEXTO:Function Convert_Decimal(Degree_Deg As String) As Double ' Declare the variables to be double precision floating-point. Dim degrees As Double Dim minutes As Double Dim seconds As Double ' Set degree to value before "" of Argument Passed. degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "") - 1)) ' Set minutes to the value between the "" and the "'" ' of the text string for the variable Degree_Deg divided by ' 60. The Val function converts the text string to a number. minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "") + 2, _ InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, _ "") - 2)) / 60 ' Set seconds to the number to the right of "'" that is ' converted to a value and then divided by 3600. seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _ 2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) _ / 3600 Convert_Decimal = degrees + minutes + secondsEnd FunctionPara utilizar esta funcin, cree una frmula de conversin, como en el ejemplo siguiente ejemplo: 1. Inicie Excel y presione ALT+F11 para iniciar el de Visual Basic Editor.2. En el men Insertar , haga clic en mdulo.3. Escriba el cdigo de ejemplo para el Convert_Decimal que personalizado funcin que se describe anteriormente en la hoja de mdulo.4. Presione ALT+F11 para volver a excel.5. En la celda A1 escriba la frmula siguiente: = Convert_Decimal("10 27' 36""")Nota: es necesario escribir tres comillas ("" ") al final el argumento de esta frmula para equilibrar las comillas para los segundos y las comillas de la cadena de texto. Una referencia de celda no requerir un signo de interrogacin. 6. La frmula devuelve 10.46