3
I have some codes that at the time of conversion to excel, appear several spaces and need to remove them via vba, but when I use the function Trim the same converts them into number instead of keeping as text.
Example:
1.1
Sub retirar_espaço()
range("A1").value = worksheetfunction.trim(range("A1"))
End sub
Answer: 1,1
The same happens when I use the replace function:
range("A1").Replace what:=" ", replacement:=""
I would like to know how to perform this operation without converting text to number.
Use the method of
.NumberFormat
or the Excel formula=TEXT()
or to convert to StringCStr()
– danieltakeshi