推 skating:正是我想要的 謝謝gofin大大 06/23 14:56
Function Newstr(ByVal oldstr As String) As String
If Left(oldstr, 1) = "-" Then
Newstr = "-" & VBA.String(10 - Len(oldstr), "0") & _
Right(oldstr, Len(oldstr) - 1)
Else
Newstr = VBA.String(10 - Len(oldstr), "0") & oldstr
End If
End Function
不知道是不是你要的!!有測過!!
※ 引述《Lohasal (生命奇蹟小狐狸)》之銘言:
: 要自己寫函數補空格 :)
: ※ 引述《skating (阿祺)》之銘言:
: : 我要定義一個字串
: : 不管字串是正負數 或是正負數含小數
: : 總位數都是10位 不滿10位前面補空格
: : 這樣的話 用format 要怎麼定義呢
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.124.126.127