我正在尝试将纬度和经度转换为 VBA 中的度数。我想编写子程序将整个列覆盖为度数。我希望它遍历整个列,但它仅适用于当前单元格。我已经使用偏移量来移动单元格。但无济于事
Sub autoConvertToDegree()
Dim sign As Integer
Dim position As Integer
Dim temp As String
Dim tok As Variant
Do
sign = 0
position = 0
tok = Null
temp = ActiveCell.Value
sign = IIf(Left(temp, 1) = "-", -1, 1)
position = InStr(temp, "+")
If (position > 0) Then Mid(temp, position) = " "
position = InStr(temp, "-")
If (position > 0) Then Mid(temp, position) = " "
temp = Replace(temp, "'", " ")
temp = Replace(temp, """", " ")
temp = LTrim(temp)
tok = Split(temp, " ")
ActiveCell.Value = sign * (tok(0) + tok(1) / 60# + tok(2) / 3600#)
ActiveCell.Offset(1, 0).Select
Loop While Application.IsText(ActiveCell.Value)
End Sub