I have some code that at the time of conversion to excel, several spaces appear and I need to remove them via vba, but when I use the trim function it converts them to number instead of keeping it 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 from text to number.