[求助]求高手帮助修改一下代码
<strong>[求助]求高手帮助修改一下代码</strong><div style="MARGIN-TOP: 10px; FONT-SIZE: 13px; MIN-HEIGHT: 200px; WORD-BREAK: break-all; TEXT-INDENT: 24px; LINE-HEIGHT: 180%; WORD-WRAP: break-word;"><p>这是一个工程测量平差代码,调试时出现错误。麻烦各位高手查看并修改一下,小弟在这里不胜感激。</p><p></p><p></p><p>Public Const pi = 3.14159265359<br/>Public Function DEG(n As Double)<br/>Dim A As Double, B As Double, C As Double, D As Double, E As Double, F As Double, G As Double, KA As Double<br/>D = Abs(n) + 0.000000000000001<br/>F = Sgn(n)<br/>A = Int(D)<br/>B = Int((D - A) * 100)<br/>C = D - A - B / 100<br/>DEG = F * (A + B / 60 + C / 0.36) * pi / 180<br/>End Function</p><p>Sub附合导线计算()<br/>Dim m As Integer, n As Integer, ms As Double, gg As Double, sht As Object, xx As Double, yy As Double, S As Double<br/>Set sht = ThisWorkbook.ActiveSheet<br/>Do While sht.Cells(m + 3, 4) <> ""<br/>m = m + 1<br/>Loop<br/>For n = 3 To m + 2<br/>ms = DEG(ms) + DEG(sht.Cells(n, 4))<br/>ms = RAD(ms)<br/>S = S + sht.Cells(n, 3)<br/>Next<br/>ms = DEG(ms)<br/>gg = RAD(DEG(sht.Cells(3, 5)) + ms - DEG(sht.Cells(3 + m, 5)) - pi * m)<br/>xx = 0: yy = 0<br/>For n = 4 To m + 2<br/>'方位角<br/>sht.Cells(n, 5) = RAD(DEG(sht.Cells(n - 1, 5)) + DEG(sht.Cells(n - 1, 4)) - pi - DEG(gg) / m)<br/>'坐标增量<br/>sht.Cells(n, 6) = Format(sht.Cells(n - 1, 3) * Cos(DEG(sht.Cells(n, 5))), "#####.####")<br/>sht.Cells(n, 7) = Format(sht.Cells(n - 1, 3) * Sin(DEG(sht.Cells(n, 5))), "#####.####")<br/>'坐标增量和<br/>xx = xx + sht.Cells(n, 6)<br/>yy = yy + sht.Cells(n, 7)<br/>Next<br/>xx = xx + sht.Cells(3, 10) - sht.Cells(m + 2, 10)<br/>yy = yy + sht.Cells(3, 11) - sht.Cells(m + 2, 11)<br/>sht.Cells(m + 4, 5) = "△α=" & Format(gg, "###.######")<br/>sht.Cells(m + 4, 6) = "△X=" & Format(xx, "###.###")<br/>sht.Cells(m + 4, 7) = "△Y=" & Format(yy, "###.###")<br/>sht.Cells(m + 4, 3) = "∑S=" & Format(S, "###.###")<br/>sht.Cells(m + 4, 9) = "△S=" & Format(Sqr(xx * xx + yy * yy), "###.###")<br/>sht.Cells(m + 4, 10) = "相对精度 1/" & Format(S / Sqr(xx * xx + yy * yy), "######")<br/>For n = 4 To m + 2<br/>sht.Cells(n, 8) = Format(xx / S * sht.Cells(n - 1, 3), "###.####")<br/>sht.Cells(n, 9) = Format(yy / S * sht.Cells(n - 1, 3), "###.####")<br/>Next<br/>For n = 4 To m + 1<br/>sht.Cells(n, 10) = sht.Cells(n - 1, 10) + sht.Cells(n, 6) - sht.Cells(n, 8)<br/>sht.Cells(n, 11) = sht.Cells(n - 1, 11) + sht.Cells(n, 7) - sht.Cells(n, 9)<br/>Next<br/> Columns("F:K").Select<br/> Selection.NumberFormatLocal = "0.000_ "<br/>End Sub<br/>Public Function RAD(Nu As Double) As Double<br/>Dim A As Double, B As Double, C As Double, D As Double, E As Double, F As Double, G As Double, p As Double<br/>D = Abs(Nu)<br/>F = Sgn(Nu)<br/>p = 180# / pi<br/>G = p * 60#<br/>A = Int(D * p)<br/>B = Int((D - A / p) * G)<br/>W = B<br/>C = (D - A / p - B / G) * 20.62648062<br/>RAD = (C + A + B / 100) * F<br/>End Function</p></div> 太高深了,看不懂。。。
页:
[1]