Quote:
Originally Posted by dannat
Glad you liked the vbasic stuff - thanks for the tweak as well
|
Hi dannat...can I grovel for some more help.....
I'm trying to use the spreadsheet to convert decimal DEC degrees to DEC degrees minutes seconds so I can order all DEC angles.
I know it's been done and I can do it with excel but it would sure be nice to do it with a VB script.
At the moment the script (I fiddled with) won't convert the -ve DEC degrees..It returns 0°0'00".
I tried this VBS (calling the function "Convert_DEC_Degree"):
Function Convert_DEC_Degree(Decimal_DEC_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_DEC_Degree = " " & Degrees & "° " & Int(Minutes) & "' " _
& Seconds + Chr(34)
End With
End Function
To enter the VBS function is "he command function is "=convert_DEC_Degree()"
Any help?Pretty please!
P.S.
I just noticed I get a "!" mark in the RA column and when I hover my mouse over this "!" it states "The formula in this cell differs from the formulas in this areas of the spreadsheet". Of course the RA column is next to the DEC column.
The RA column is ordered by your previous VBS script..except I changed line 13 to: "Convert_Degree = " " & Degrees & "h " & Int(Minutes) & "' " _"
This returns RA in hours minutes and degrees, "10h27'36".
P.P.S
I looked up the help and the above is just a warning that the formula is different from the one in the column next to it .....thats' all