I have a cell in a table that reads:
64123
where there is some sort of white space after 3. I thought it was a blank space, so in my vba code, I've tried multiple ways of getting this blank space OUT of the string, but neither application.trim
nor replace
work.
With Cells(c.Row, 16)
.NumberFormat = "General"
v = Application.Trim(.Text)
v = Replace(v, " ", "")
Debug.Print v
.Clear
.NumberFormat = "General"
.Value = Application.Trim(v)
End With
There is definitely a blank space at the end - I can see it when I highlight the cell in Excel, and Application.Trim
has ALWAYS worked for me. What else could this be other than a blank space? If it's a tab or a carriage return, what's the replace
syntax for those?
Application.Trim
when you can useTrim
? (i.e.VBA.Strings.Trim
) – Mathieu Guindon