Hieunghia Tại 3/7/2013 10:03:39

Chuyển đổi qua lại giữa Radian và Độ phút giây trong Excel

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.

- Doiso 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.
https://lh4.googleusercontent.com/-y6E10wYZ1JE/UK2imMYSq5I/AAAAAAAAAWo/5QPNPsYDRV8/s400/%25E1%25BA%25A2nh%2Bch%25E1%25BB%25A5p%2Bm%25C3%25A0n%2Bh%25C3%25ACnh_2012-11-22_105613.png
Tải tập tin đính kèm tại đây.

trang: [1]
Phiên bản đầy đủ: Chuyển đổi qua lại giữa Radian và Độ phút giây trong Excel