Function DelSpace(ByVal TStr As String) As String Dim TempStr As String Dim TempInt As Integer TempInt = InStr(TStr, Space(1)) Do While Not TempInt = 0 TStr = VBA.Left(TStr, TempInt - 1) & VBA.Right(TStr, Len(TStr) - TempInt) TempInt = InStr(TStr, Space(1)) Loop DelSpace = TStr End Function
Dim TempStr As String
Dim TempInt As Integer
TempInt = InStr(TStr, Space(1))
Do While Not TempInt = 0
TStr = VBA.Left(TStr, TempInt - 1) & VBA.Right(TStr, Len(TStr) - TempInt)
TempInt = InStr(TStr, Space(1))
Loop
DelSpace = TStr
End Function
y = Trim(y)
这样就可以了。
ltrim(rtrim(ss))
小新说得对