Ngày đăng: Nov 22, 2012 3:58:55 AM
Chuyển từ độ (định dạng demical nhé) sang độ phút giây, sang radian và ngược lại:
Làm theo các bước sau để dùng đoạn mã VBA:
1. Trong Excel nhấn ALT+F11.
2. Trong menu Insert, click Module.
3. Paste đoạn mã trên đây vào ô bên cạnh (cửa sổ module sheet).
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 = " " & Degrees & "° " & Int(Minutes) & "' " _
& Seconds + Chr(34)
End With
End Function
4. Nhấn ALT+F11 để quay về Excel.
5. Ví dụ: muốn đổi 10.46 độ sang độ phút giây thì đánh như sau:
=Convert_Degree(10.46)
Kết quả thu được là 10°27'36"
Hoặc:
1. Trong Excel nhấn ALT+F11.
2. Trong menu File , click Import file chọn 2 file đính kèm trong thư mục này.
- Doi so thap phan ra do phut giay
- Doi do phut giay ra so thap phan
3. Nhấn ALT+F11 để quay về Excel.
Ví dụ: muốn đổi 10.46 độ sang độ phút giây thì đánh như sau:
=Convert_Degree(10.46)
Kết quả thu được là 10°27'36"
Chi tiết xem trong file mẫu đính kèm.