09. december 2013 - 19:09Der er
9 kommentarer og 1 løsning
To tegn
Hej
Jeg har lavet / fundet på nettet dette modul til excel: Function Convert_Degree(Decimal_Deg) As Variant With Application 'Set degree to Integer of Argument Passed Degrees = Int(Decimal_Deg) 'Set minutes to 60 times the number to the right 'of the decimal for the variable Decimal_Deg Minutes = (Decimal_Deg - Degrees) * 60 'Set seconds to 60 times the number to the right of the 'decimal for the variable Minute Seconds = Format(((Minutes - Int(Minutes)) * 60), "0") 'Returns the Result of degree conversion '(for example, 10.46 = 10~ 27 ' 36") Convert_Degree = "N" & Degrees & " " & Int(Minutes) & " " _ & Seconds & ".0" End With End Function
Det virker også, men jeg vil gerne hvis den kan sætte N ind hvis det er et positivt tal og S hvis det er et negativt
Det jeg prøvet at omregne 35,171819 det skal blive til N35 10 19.0 -35,171819 det skal blive til S35 10 19.0
Function Convert_Degree(Decimal_Deg) As Variant With Application 'Set degree to Integer of Argument Passed Degrees = Int(Decimal_Deg) 'Set minutes to 60 times the number to the right 'of the decimal for the variable Decimal_Deg Minutes = (Decimal_Deg - Degrees) * 60 'Set seconds to 60 times the number to the right of the 'decimal for the variable Minute Seconds = Format(((Minutes - Int(Minutes)) * 60), "0") 'Returns the Result of degree conversion '(for example, 10.46 = 10~ 27 ' 36") Convert_Degree = iif(Decimal_Deg<0,"S","N") & Degrees & " " & Int(Minutes) & " " _ & Seconds & ".0" End With End Function
Nu har jeg lavet den sådan har Function Convert_Degree(Decimal_Deg) As Variant With Application 'Set degree to Integer of Argument Passed Degrees = Int(Abs(Decimal_Deg)) 'Set minutes to 60 times the number to the right 'of the decimal for the variable Decimal_Deg Minutes = (Abs(Decimal_Deg - Degrees)) * 60 'Set seconds to 60 times the number to the right of the 'decimal for the variable Minute Seconds = Format(Abs(((Minutes - Int(Minutes)) * 60)), "0") 'Returns the Result of degree conversion '(for example, 10.46 = 10~ 27 ' 36") Convert_Degree = IIf(Decimal_Deg < 0, "S", "N") & Degrees & " " & Int(Minutes) & " " _ & Seconds & ".0" End With End Function
Men den dumme maskine skriver stadig S35 4210 19.0 hvor den skal skrive S35 10 19.0
Så virker den takker mange gange, skriv svar så du kan så point
Function Convert_Degree(Decimal_Deg) As Variant With Application 'Set degree to Integer of Argument Passed Degrees = Int(Abs(Decimal_Deg)) 'Set minutes to 60 times the number to the right 'of the decimal for the variable Decimal_Deg Minutes = (Abs(Decimal_Deg) - Degrees) * 60 'Set seconds to 60 times the number to the right of the 'decimal for the variable Minute Seconds = Format(((Abs(Minutes - Int(Minutes)) * 60)), "0") 'Returns the Result of degree conversion '(for example, 10.46 = 10~ 27 ' 36") Convert_Degree = IIf(Decimal_Deg < 0, "S", "N") & Degrees & " " & Int(Minutes) & " " _ & Seconds & ".0" End With End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.