How can I replace the nummber '0' for a space ' ' ?
(number = "00021" / must be " 21")
Printable View
How can I replace the nummber '0' for a space ' ' ?
(number = "00021" / must be " 21")
NewNum = Format(Number,"#####")
Assuming your variable, "Number" is a string, a simple Val command is all you need:
-Joe JordanCode:number = Val(number)
Ignite Software
http://www.IgniteSoft.com/
Use the Recplace() function. (VB6 Only).
If you have VB5, you can use the following duplication.Code:Text1 = Replace(Text1, "0", "")
Code:Public Function Replace(sIn As String, sFind As String, _
sReplace As String, Optional nStart As Long = 1, _
Optional nCount As Long = -1, Optional bCompare As _
VbCompareMethod = vbBinaryCompare) As String
Dim nC As Long, nPos As Integer, sOut As String
sOut = sIn
nPos = InStr(nStart, sOut, sFind, bCompare)
If nPos = 0 Then GoTo EndFn:
Do
nC = nC + 1
sOut = Left(sOut, nPos - 1) & sReplace & _
Mid(sOut, nPos + Len(sFind))
If nCount <> -1 And nC >= nCount Then Exit Do
nPos = InStr(nStart, sOut, sFind, bCompare)
Loop While nPos > 0
EndFn:
Replace = sOut
End Function