Lm th? no ? chuy?n ?i ?/pht/giy gc ?n ho?c t? gc ? th?p phn trong Excel 2000

D?ch tiu ? D?ch tiu ?
ID c?a bi: 213449 - Xem s?n ph?m m bi ny p d?ng vo.
M?t phin b?n Microsoft Excel 97 c?a bi vi?t ny, xem cc 121944.

M?t phin b?n Microsoft Excel 98 c?a bi vi?t ny, xem cc 192367.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Cc php o gc th?ng ?c th? hi?n b?ng n v? c?a ?, pht v giy (DMS). M?t m?c ? b?ng 60 pht, v m?t pht b?ng 60 giy. ? n gi?n ha m?t s? tnh ton ton h?c b?n c th? mu?n ? th? hi?n cc php o gc ? v lin phn s? th?p phn c?a ?.

Bi vi?t ny ch?a m?t ch?c nng ty ch?nh m?u, b?n c th? s? d?ng ? chuy?n ?i m?t gi tr? m?c ? lu trong ?nh d?ng th?p phn, ? DMS ?c lu tr? trong vn b?n ?nh d?ng, v m?t ch?c nng m?u chuy?n ?i DMS vo m?t gi tr? m?c ? lu tr? trong ?nh d?ng th?p phn.

THNG TIN THM

Microsoft cung c?p l?p tr?nh v d? ? minh ho? ch?, khng c b?o hnh ho?c th? hi?n hay ng? ?, bao g?m nhng khng gi?i h?n, b?o ?m ng? ? kh? nng bn hng v/ho?c cho m?t m?c ch c? th?. Bi vi?t ny gi? ?nh r?ng b?n ? quen thu?c v?i ngn ng? l?p tr?nh ?c ch?ng minh v cc cng c? ?c s? d?ng ? t?o ra v g? l?i th? t?c. Microsoft h? tr? cc chuyn gia c th? gip gi?i thch cc ch?c nng c?a m?t th? t?c c? th?, nhng h? s? khng s?a ?i cc v d? ? cung c?p thm ch?c nng ho?c xy d?ng quy tr?nh ? p ?ng nhu c?u c? th? c?a b?n.
N?u b?n c h?n ch? kinh nghi?m l?p tr?nh, b?n c th? mu?n lin h? v?i m?t Microsoft Certified Partner ho?c d?ch v? t v?n c?a Microsoft. ? bi?t thm chi ti?t, truy c?p vo cc trang Web Microsoft:

Microsoft Certified ?i tc- https://Partner.Microsoft.com/Global/30000104

D?ch v? t v?n c?a Microsoft- http://support.Microsoft.com/GP/advisoryservice

? bi?t thm v? cc ty ch?n h? tr? c s?n v v? lm th? no ? lin h? v?i Microsoft, gh thm Web site sau c?a Microsoft:http://support.Microsoft.com/Default.aspx?SCID=FH;EN-US;CNTACTMS

Chuy?n ? th?p phn sang ?/pht/giy

Sau y cho cc ?ng d?ng ty ch?nh c?a Microsoft Visual Basic ch?c nng ch?p nh?n m?t gc ?c ?nh d?ng lm m?t gi tr? th?p phn v chuy?n n ?n m?t gi tr? vn b?n hi?n th? trong ?, pht v giy.

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
				
S? d?ng ch?c nng ny, t?o ra m?t cng th?c chuy?n ?i, nh ? y V d?:
  1. B?t ?u Excel v b?m phm ALT + F11 ? b?t ?u Visual Basic bin t?p vin.
  2. Trn cc Chn tr?nh n, nh?p vo M-un.
  3. Nh?p m? m?u cho Convert_Degree ty ch?nh ch?c nng m t? ? trn vo t? m-un.
  4. Nh?n ALT + F11 ? tr? v? ? excel.
  5. Trong cell A1 g? 10.46.
  6. Trong t? bo A2 g? cng th?c sau y:
    =Convert_Degree(a1)


    Cng th?c tr? v? 10 27'36 "

Chuy?n ?i ? pht ?n ? th?p phn

Sau y cho cc ?ng d?ng ty ch?nh c?a Microsoft Visual Basic ch?c nng ch?p nh?n m?t chu?i vn b?n ?, pht v giy ?nh d?ng trong cc chnh xc cng m?t ?nh d?ng Convert_Degree ch?c nng tr? v? (v d?, 10 27' 36 ") v chuy?n n ?n m?t gc ?c ?nh d?ng lm m?t gi tr? th?p phn. i?u ny l chnh xc l ?o ng?c c?a ch?c nng ty ch?nh Convert_Degree.

C?NH BO: Ch?c nng tu? ch?nh ny th?t b?i n?u ?i s? Degree_Deg khng ph?i l trong ?nh d?ng sau
<degrees> <minutes>' <seconds>" </seconds></minutes></degrees>
ngay c? khi gi tr? giy l 0.
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 + seconds
End Function
				
S? d?ng ch?c nng ny, t?o ra m?t cng th?c chuy?n ?i, nh ? y V d?:
  1. B?t ?u Excel v b?m phm ALT + F11 ? b?t ?u Visual Basic Bin t?p vin.
  2. Trn cc Chn tr?nh n, nh?p vo M-un.
  3. Nh?p m? m?u cho Convert_Decimal ty ch?nh ch?c nng m t? ? trn vo t? m-un.
  4. Nh?n ALT + F11 ? tr? v? ? excel.
  5. Trong cell A1 g? cng th?c sau y:
    = Convert_Decimal("10 27' 36""")
    LU ?: B?n ph?i g? ba d?u ngo?c kp ("" ") ? cu?i c?a cc ?i s? c?a cng th?c ny ? cn b?ng bo gi nh d?u cho giy v nh d?u ngo?c kp cho chu?i vn b?n. M?t tham chi?u di ?ng s? khng yu c?u m?t bo gi nh d?u.
  6. Cng th?c tr? v? 10.46

Thu?c tnh

ID c?a bi: 213449 - L?n xem xt sau cng: 20 Thang Chin 2011 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Office Excel 2003
  • Microsoft Excel 2010
  • Microsoft Office Excel 2007
T? kha:
kbfunctions kbconvert kbsample kbdtacode kbhowto kbprogramming kbmt KB213449 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:213449

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com