樁號的格式為:Kd+d,其中d是數(shù)字。

如何將左邊的數(shù)字轉(zhuǎn)換為樁號

選中需要轉(zhuǎn)換的單元格區(qū)域,點擊轉(zhuǎn)換為樁號按鈕即可
代碼如下:
Sub 數(shù)字轉(zhuǎn)樁號()
For Each r In Selection
If Application.WorksheetFunction.IsNumber(r.Value) Then
kp = Int(r.Value / 1000)
pp = r.Value Mod 1000
If pp > 100 Then '如果pp大于100,那么
r.Value = "K" & kp & "+" & pp
ElseIf pp > 10 Then
r.Value = "K" & kp & "+0" & pp
ElseIf pp >= 0 Then
r.Value = "K" & kp & "+00" & pp
End If
End If
Next r
End Sub

一個圖片